[Release] SDL-3DS 1.2.15 - Simple DirectMedia Layer for 3DS

Discussion in '3DS - Homebrew Development and Emulators' started by nop90, Jan 30, 2017.

  1. nop90
    OP

    nop90 GBAtemp Advanced Maniac

    Member
    12
    Jan 11, 2014
    Italy
    Rome
    Is it correct to separate paths with a ":" char? on widwows it's a ";".
     
  2. Joom

    Joom  ❤❤❤

    Member
    14
    Jan 8, 2016
    United States
    Yes. I'm thinking he's not properly setting the variable though, and isn't including /bin and /usr in his PATH.
     
  3. titoEarly

    titoEarly Member

    Newcomer
    1
    Jan 12, 2016
    Code:
    pedro4@pedroSystem ~/Repositories/SDL-3DS $ echo $PATH
    /opt/devkitpro/devkitARM/bin:/opt/devkitpro/portlibs/3ds/bin:/opt/devkitpro/portlibs/armv6k/bin:/home/pedro4/bin:/home/pedro4/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
    
    Not sure if something else needs to be added
     
  4. realWinterMute

    realWinterMute GBAtemp Regular

    Member
    4
    Feb 24, 2011
    Are you still using sudo after fixing the x bit? The path won't propagate if you use sudo
     
  5. titoEarly

    titoEarly Member

    Newcomer
    1
    Jan 12, 2016
    If I don't use sudo, I have permission issues; if I use it, path won't propagte. I guess I'll modify root's PATH var.
     
  6. realWinterMute

    realWinterMute GBAtemp Regular

    Member
    4
    Feb 24, 2011
    No, don't do that. What permission errors are you getting?

    sudo -E will preserve environment though.
     
  7. urherenow

    urherenow GBAtemp Psycho!

    Member
    9
    Mar 8, 2009
    United States
    Japan
    Depending on your config, sudo -H can also be valid... There were several things (like pycryptodome) I had to use that for to get my setup configured for a build environment. I'm using Ubuntu bash on Windows (latest version from app store /w Fall creator's update). It was a small adventure figuring out how to config the darn thing (and remembering to NOT edit anything with Windows apps... gotta use nano or something from within bash).
     
    Last edited by urherenow, Nov 4, 2017
  8. titoEarly

    titoEarly Member

    Newcomer
    1
    Jan 12, 2016
    That worked, although got a bunch of warnings through the process and got an error with SDL_ttf (guess it's because I don't have freetype installed from 3ds_portlibs?) I'm going to make sure it was installed correctly by compiling a 3ds project which includes SDL/SDL.h tho

    EDIT:

    I installed some portlibs (zlib, bzip2, libpng and freetype) and got a new error related to SDL_ttf (the one I got before editing is now gone):

    Code:
    In file included from /usr/include/SDL/SDL_main.h:26:0,
                     from /usr/include/SDL/SDL.h:30,
                     from SDL_ttf.c:46:
    /usr/include/SDL/SDL_stdinc.h:123:20: error: size of array 'SDL_dummy_enum' is negative
            typedef int SDL_dummy_ ## name[(x) * 2 - 1]
                        ^
    /usr/include/SDL/SDL_stdinc.h:151:1: note: in expansion of macro 'SDL_COMPILE_TIME_ASSERT'
     SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
     ^~~~~~~~~~~~~~~~~~~~~~~
    SDL_ttf.c: In function 'UTF8_to_UNICODE':
    SDL_ttf.c:943:11: warning: overflow in implicit constant conversion [-Woverflow]
        ch  =  (Uint16)(utf8[i]&0x07) << 18;
               ^
    Makefile:545: fallo en las instrucciones para el objetivo 'SDL_ttf.lo'
    make[1]: *** [SDL_ttf.lo] Error 1
    make[1]: se sale del directorio '/home/pedro4/Repositories/SDL-3DS/SDL_ttf-2.0.11'
    Makefile:92: fallo en las instrucciones para el objetivo 'SDL_ttf'
    make: *** [SDL_ttf] Error 2
    
     
    Last edited by titoEarly, Nov 4, 2017
  9. nop90
    OP

    nop90 GBAtemp Advanced Maniac

    Member
    12
    Jan 11, 2014
    Italy
    Rome
    SDL_dummy_enum size check fails for the 3ds toolchain (and for many others too, like DS or PSVITA), but if the _3DS variable is defined in the makefile, that check should be skipped.

    If you are correctly using my makefile, the SDL lib is compiled with the -D_3DS parameter and the same parameter is defined in the sdl-config file that the other SDL libs should recall.

    Maybe the directory where the sdl-config file should be installed doesn'r exist and the makefile doesn't have permission to create it, or maybe it exist but doesn't have write permission. But the problem could be something else.

    I know of othe people having the problem of the missing execution permission on the autogen.sh file, but fixed that everything worked fine, so I don't have other hints to give you.
     
  10. titoEarly

    titoEarly Member

    Newcomer
    1
    Jan 12, 2016
    Maybe there are some dependencies I'm not aware of that should be installed? I've only installed freetype2, but it might be necessary to install something else? I also installed this https://www.libsdl.org/release/SDL-devel-1.2.15-1.x86_64.rpm

    As for sdl-config, I found it in SDL-3DS/SDL-1.2.15. I made sure I have 777ed that directory and also sdl-config, but still getting the same output.
     
  11. nop90
    OP

    nop90 GBAtemp Advanced Maniac

    Member
    12
    Jan 11, 2014
    Italy
    Rome
    the SDL devel x86 is the sdl lib for code running on your PC, my lib is for running code on the 3ds and your PC is used only to cross compile for the 3ds target system.

    About the sdl-config file, you found the on generated at compile time, but the makefile try to copy it in the portlibs\3ds\bin folfer. Check if it's there.

    If not, create the bin folder and set write permissions to it, than install again the sdl lib

    Edit:you need also the sdl.pc file in portlibs\3ds\lib\pkgconfig
     
    Last edited by nop90, Nov 5, 2017
  12. titoEarly

    titoEarly Member

    Newcomer
    1
    Jan 12, 2016
    /opt/devkitpro/portlibs/3ds/bin folder existed but only arm-none-eabi-pkg-config was there, no sdl-config.
    /opt/devkitpro/portlibs/3ds/lib (and /pkgconfig) folder didn't exist so I created them and set write permissions. Not sure if I have to copy sdl.pc in there or the makefile will do that?
    After doing this, i tried to install the sdl lib again but still the same.

    Also, I was wondering if there's a precompiled version of this so I'd simply have to copy the files in /opt/devkitpro folder?
     
  13. nop90
    OP

    nop90 GBAtemp Advanced Maniac

    Member
    12
    Jan 11, 2014
    Italy
    Rome
    After make all, are you running make install? It should copy every file in the right place.

    I you don't solve I can provide you the compiled libs, but it's better if you find the problem and solve it, or you could find it again compiling your homebrews.
     
  14. titoEarly

    titoEarly Member

    Newcomer
    1
    Jan 12, 2016
    Well, make all doesn't even finish successfully but yeah, I tried to run make install after that despite the failure and I got the same error.

    I'd like to solve it too but I'm clueless about what it could be causing it.

    EDIT: I could try and install everything on Windows but I'd prefer to do it in Linux since it's what I'm most used to. Also I don't know how I would run make on Windows.

    EDIT 2: Don't know why, I just rebooted my computer and ran make. And it no longer fails with SDL_ttf. I'm getting a new error this time related to SDL_mixer

    Code:
    patching file configure.in
    Reversed (or previously applied) patch detected!  Skipping patch.
    1 out of 1 hunk ignored -- saving rejects to file configure.in.rej
    patching file music_ogg.c
    Reversed (or previously applied) patch detected!  Skipping patch.
    1 out of 1 hunk ignored -- saving rejects to file music_ogg.c.rej
    Makefile:108: fallo en las instrucciones para el objetivo 'SDL_mixer'
    make: *** [SDL_mixer] Error 1
    
     
    Last edited by titoEarly, Nov 7, 2017
  15. titoEarly

    titoEarly Member

    Newcomer
    1
    Jan 12, 2016
    I've been installing some portlibs that @nop90 mentioned in older posts that were needed in order to install SDL_mixer: libogg, tremor, libmikmod, libmad. I thought that would fix the previous error but it doesn't. I'm clueless about what's the problem since it doesn't say much, just that it failed at line 108. Is there something from the makefile I can remove to make it work?

    Code:
    $(SDL_MIXER): $(SDL_MIXER_SRC)
        @[ -d $(SDL_MIXER_VERSION) ] || tar --exclude=SDL_mixer-1.2.12/Xcode -xzf $<
        @cd $(SDL_MIXER_VERSION) && \
         patch -Np1 -i ../$(SDL_MIXER_VERSION).patch && \
         ./autogen.sh &&\
         ./configure --prefix=$(LIBS_PATH)/3ds --host=arm-none-eabi --disable-shared --enable-static \
         --disable-music-cmd --enable-music-wave --enable-music-midi --enable-music-mod --enable-music-mp3-mad-gpl --enable-music-ogg --enable-music-ogg-tremor
        @$(MAKE) -C $(SDL_MIXER_VERSION)
    It's doing the patch so I suppose the error is right after it but I don't really know :\
     
  16. nop90
    OP

    nop90 GBAtemp Advanced Maniac

    Member
    12
    Jan 11, 2014
    Italy
    Rome
    If already patched the patch fails and make stops.

    Clean the folder and run the makefile again (that will download a clean source).
     
  17. titoEarly

    titoEarly Member

    Newcomer
    1
    Jan 12, 2016
    I did that, I downloaded the project in a different folder and tried to run make again. I got a different error this time, but still related to SDL_mixer:

    Code:
    /bin/bash ./libtool --mode=link arm-none-eabi-gcc -o build/playwave build/playwave.lo -D_GNU_SOURCE=1 -ffunction-sections -fdata-sections -march=armv6k -mtune=mpcore -mfloat-abi=hard -mword-relocations -DARM11 -D_3DS -I/opt/devkitpro/portlibs/3ds/include/SDL -I/opt/devkitpro/libctru/include -L/opt/devkitpro/portlibs/3ds/lib -L/opt/devkitpro/portlibs/3ds -L/opt/devkitpro/libctru/lib -specs=3dsx.specs -march=armv6k -mfloat-abi=hard -lSDL -lcitro3d -lctru build/libSDL_mixer.la
    libtool: link: warning: library `/opt/devkitpro/portlibs/armv6k/lib/libmikmod.la' was moved.
    libtool: link: warning: library `/opt/devkitpro/portlibs/armv6k/lib/libmikmod.la' was moved.
    libtool: link: arm-none-eabi-gcc -o build/playwave build/playwave.o -D_GNU_SOURCE=1 -ffunction-sections -fdata-sections -march=armv6k -mtune=mpcore -mfloat-abi=hard -mword-relocations -DARM11 -D_3DS -I/opt/devkitpro/portlibs/3ds/include/SDL -I/opt/devkitpro/libctru/include -specs=3dsx.specs -march=armv6k -mfloat-abi=hard  -L/opt/devkitpro/portlibs/3ds/lib -L/opt/devkitpro/portlibs/3ds -L/opt/devkitpro/libctru/lib -L/opt/devkitpro/portlibs/armv6k/lib build/.libs/libSDL_mixer.a /opt/devkitpro/portlibs/3ds/lib/libSDL.a -lcitro3d /opt/devkitpro/portlibs/armv6k/lib/libmikmod.a /opt/devkitpro/portlibs/armv6k/lib/libvorbisidec.a -lvorbis /opt/devkitpro/portlibs/armv6k/lib/libogg.a /opt/devkitpro/portlibs/armv6k/lib/libmad.a -lctru -lm
    /opt/devkitpro/devkitARM/lib/gcc/arm-none-eabi/7.1.0/../../../../arm-none-eabi/bin/ld: cannot find -lvorbis
    collect2: error: ld returned 1 exit status
    Makefile:69: fallo en las instrucciones para el objetivo 'build/playwave'
    make[1]: *** [build/playwave] Error 1
    make[1]: se sale del directorio '/home/pedro4/Repositories/sdl_new/SDL_mixer-1.2.12'
    Makefile:108: fallo en las instrucciones para el objetivo 'SDL_mixer'
    make: *** [SDL_mixer] Error 2
    
     
  18. nop90
    OP

    nop90 GBAtemp Advanced Maniac

    Member
    12
    Jan 11, 2014
    Italy
    Rome
    Having different errors at every try is not a good thing, with patience you'll solve everything.

    This problem reported by the compiler is that the vorbis lib is missing from your portlibs folder. The strange thing is that it shouldn't be needed since on 3ds is used libtremor.

    This could be my mistake configuring the package (time ago I installed libborbis too, but I don't use it. This could be the reason I don't have any problem).

    For a fast and dirty fix, edit the makefile in the SDL_mizer folder and remove -lvorbis flag, than run make from this folder (this should compile the SDL_Mixer lib if there aren't other problems).

    Than you can compile the other libs one by one from the main folder running:
    • make SDL_net
    • make SDL_gfx
    • make SDL_sound
    and finally run make install.

    When I have time I'll check the lib, but now I'm leaving for Japan and I'll back on 21 November, so this have to wait :)
     
    titoEarly and cearp like this.
  19. titoEarly

    titoEarly Member

    Newcomer
    1
    Jan 12, 2016
    That worked! I removed -lvorbis and it worked. I also had to make some more changes to the Makefile cause it failed at some points but it's finally installed.

    Thanks for your help and enjoy your visit to Japan!

    EDIT:

    So I've been trying to compile one of @nop90 's projects (KETM). It compiled (with too many warnings) successfuly so I got the .3dsx and the .smdh. I tried to run the game in my 3DS but it didn't work. Bottom screen turns brown everytime I open the game, so I guess even though there was no error, the game wasn't correctly compiled.

    Has anyone ver experienced anything like this?
     
    Last edited by titoEarly, Nov 12, 2017
  20. titoEarly

    titoEarly Member

    Newcomer
    1
    Jan 12, 2016
    Hello! I've been making some progress with SDL for 3DS, but I think I may have found 2 bugs:

    1) Whenever I try to SDL_Init(SDL_INIT_EVERYTHING); the app crashes. I have to do something like SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO); It's not much of a problem, just to let you know in case you didn't notice.

    2) This one is either a bug or a problem of mine. I don't seem to be able to use IMG_Load(). I made a simple app that loads a background and an image using SDL_LoadBMP() and it works fine. I changed SDL_LoadBMP() to IMG_Load() (also I included #include <SDL/SDL_image.h>) and tried to load the same BMP files and the app crashes, showing a red bottom screen. Not sure if this is a bug or not since I've seen some other projects use this IMG_Load() function, although I haven't been able to check myself if it was working good in those projects but in case it wasn't a bug, why can't I use it? (In the makefile I use these libs: -lSDL_mixer -lSDL_image -lSDL -lmikmod -lmad -lvorbisidec -logg -lpng -ljpeg -lz -lcitro3d -lctru -lm). The app is always compiled with 0 warning and 0 error.

    I also tried loading a PNG in case BMP wasn't supported by IMG_Load() (which wouldn't make sense at all but who knows) and it didn't work either.

    Here's an image that shows what I explained:
    Warning: Spoilers inside!
     
Quick Reply
Draft saved Draft deleted
Loading...