1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Dismiss Notice

dumb question: getting SDL2 on pandora (using codeblocks pnd)

Discussion in 'C /C ++' started by NixTrix, Feb 12, 2016.

  1. NixTrix

    NixTrix Member

    Joined:
    Jul 9, 2011
    Messages:
    151
    Question as above.
    Trying to compile MilkyTracker on pandora but it uses SDL2 and the codeblocks pnd only contains SDL1.2. I'd like a little bit of guidance in the right direction before I go plunging myself into completely the wrong thing; just a list of instructions that I can go off and follow would be plenty and I'd be very grateful for.

    Cheers!
     
    Tags:
  2. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    7,539
    Location:
    France, near Lyon
    the codeblocks pnd contains both SDL1.2 and SDL2. What error do you have?
     
  3. NixTrix

    NixTrix Member

    Joined:
    Jul 9, 2011
    Messages:
    151
    I type ./configure and everything seems to work fine until this point:

    Code:
    checking for SDL... no
    checking for sdl2-config... no
    checking for SDL - version >= 2.0.0... no
    *** The sdl2-config script installed by SDL could not be found
    *** If SDL was installed in PREFIX, make sure PREFIX/bin is in
    *** your path, or set the SDL2_CONFIG environment variable to the
    *** full path to sdl2-config.
    configure: error: Please install libSDL
     
  4. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    7,539
    Location:
    France, near Lyon
    in command line, type "sdl2-config" to check it's there.

    If it's there, edit your configure script and change #!/bin/sh to #!/bin/bash
     
  5. NixTrix

    NixTrix Member

    Joined:
    Jul 9, 2011
    Messages:
    151
    Running sdl2-config from the command line gives a "command not found" error. It looks like sdl-config is there though.
     
  6. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    7,539
    Location:
    France, near Lyon
    What version on codeblocks do you have ?
     
  7. NixTrix

    NixTrix Member

    Joined:
    Jul 9, 2011
    Messages:
    151
    Good point, don't know why I didn't think of that myself! I'll update the pnd and give it another go.
    --- Double Post Merged, Feb 13, 2016, Original Post Date: Feb 13, 2016 ---
    Alright, that did the trick and it compiled successfully! Now I have a couple other questions: in fullscreen mode, touch screen input is wildly off, and in windowed mode the display doesn't seem to update properly (always appears to be one frame behind, most noticeable when you drag the window off the screen and back on; the display is filled with that repeating trail effect until you press a key; and when opening a menu another key press is required before the menu shows properly). Would your SDL2 patch fix this? If so, how do I apply it?
     
  8. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    7,539
    Location:
    France, near Lyon
    first thing, the SDL2 version inside codeblocks use desktop OpenGL (via glshim) to display. Like with most GL app on the Pandora, you don't want to use windowed mode. So you should force fullscreen. Also, use
    Code:
     export LIBGL_FB=1 
    to be compatible with newer graphic driver.

    If you want to use GLES|2 backend (to have shaders for example), use those export:
    Code:
    export SDL_VIDEO_GLES2=1 
    export SDL_VIDEO_GL_DRIVER=libGLESv2.so
    
    You still want to use fullscreen mode.

    I hope it awnser a few questions.
     
  9. NixTrix

    NixTrix Member

    Joined:
    Jul 9, 2011
    Messages:
    151
    Alright, it's working almost perfectly! For some reason it automatically switches to non-fullscreen even after I FORCE fullscreen to be enabled in the source code, but a simple alt+enter does the trick. Shouldn't be too hard to fix, probably fullscreen being switched off somewhere else in the source code.

    Quick question, how do I bundle the shared object files I need with the program? milkytracker gives me a "cannot find libsdl2.so.0" error or something similar (I'm not with my pandora right now) unless I keep the codeblocks pnd open in the background.

    I'm probably going to open a thread about milkytracker for pandora on the software releases page, so I can tidy it up with people's guidance before I release it for real on the repo. We need a milkytracker that's more touchscreen-friendly after all :D

    Sorry for the late reply and cheers again for your help!
     
  10. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    7,539
    Location:
    France, near Lyon
    there a little helper script in codeblocks that can do that.
    go to you your "lib" folder and use
    Code:
    copy_libs.sh /PATH/TO/EXE
    
    the script will analyse "ldd" output and copy libs that are not in the firmware in current folder (and the copy_libs.sh can by use with *)
     
  11. NixTrix

    NixTrix Member

    Joined:
    Jul 9, 2011
    Messages:
    151
    That copy_libs script is awesome! Thanks for letting me know about it!
    With a quick "export LD_LIBRARY_PATH=." milkytracker now starts up with no problem when the codeblocks pnd isn't running, but there's one more bug to iron out... if the codeblocks pnd isn't running, then as soon as I touch the screen or move the mouse, milkytracker immediately quits out with this spiel in the terminal:
    Code:
    Xlib: sequence lost (0x10000 > 0x102) in reply type 0x3!
    X Error of failed request:  0
      Major opcode of failed request:  2 (X_ChangeWindowAttributes)
      Serial number of failed request:  0
      Current serial number in output stream:  258
    It still works just fine when the codeblocks pnd is still running. I'm imagining it's some library of which a different version is present in the codeblocks pnd but still exists in system firmware so copy_libs doesn't pick it up or something. I'm going to try upgrading SuperZaxxon (it's been a while since I've done that) and see if that sorts it out, but do let me know if you know the actual cause of this issue. Thanks again :)
     
  12. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    7,539
    Location:
    France, near Lyon
    you should create a "lib" folder for the libs, and call copy_libs.sh from there. For some libs, like X11, the script will copy things in ../share also. So in the end, you should have LD_LIBRARY_PATH=lib:$LD_LIBRARY_PATH (or nothing in you PND has it should be automaticaly done before the call).
     
  13. NixTrix

    NixTrix Member

    Joined:
    Jul 9, 2011
    Messages:
    151
    I just did this, and copy_libs.sh didn't copy anything to ../share. Even after making the directory on the same level as lib, it remains empty. I also tried copying all the libraries that came up in ldd to the lib folder to see if copy_libs missed anything, and am still encountering the same problem.

    I'm going to make a thread in the software releases section with a link to the source and binary, so anyone can take a look at it themselves as I'm sure that'll be a lot more helpful to diagnose the problem.
     
  14. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    7,539
    Location:
    France, near Lyon
    copy_libs.sh will avoid to copy ldd libs that are (after following the links) in the firmware. You can trust it to now missing libs. If it didn't copy, it's not needed. What copy_libs.sh doesn't see is libs loaded in runtime using dlopen functions This one should be copied by hand.
     
  15. NixTrix

    NixTrix Member

    Joined:
    Jul 9, 2011
    Messages:
    151
  16. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    7,539
    Location:
    France, near Lyon
    I'll take a look at the software and will get back to you

    (if you want to check, just "grep dlopen * -r" in your source folder)
     
  17. NixTrix

    NixTrix Member

    Joined:
    Jul 9, 2011
    Messages:
    151
    Yo, did a little bit more fiddling around with this recently.

    I tried this, and the only line that came up was:

    Code:
    src/milkyplay/drivers/jack/AudioDriver_JACK.cpp:    libJack = dlopen("libjack.so", RTLD_LAZY);
    
    Also copying libGL.so.1 (glshim that you mentioned in the other thread) into the libs folder didn't do anything to fix the bug.

    Searching for the cause of the bug continues.
     

Share This Page

Loading...