Unable to compile or configure for SDL_Mixer

5 posts / 0 new
Last post
hypex
hypex's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2011-09-09 16:20
Unable to compile or configure for SDL_Mixer
Hello. I've been annoyingly stuck on this for a few days. And also found I had the problem two years ago! :-o I'm trying to run a configfure script that needs SDL_Mixer and Mix_OpenAudio(). It fails as so from this log report excerp: configure:14544: checking for Mix_OpenAudio in -lSDL_mixer configure:14570: g++ -o conftest -g -O2 conftest.cpp -lSDL_mixer -lsmpeg -lm -lvorbisfile -lvorbis -logg -lstdc++ >&5 configure:14580: result: no configure:14588: error: *** SDL_mixer lib not found! Get SDL_mixer from http://www.libsdl.org/projects/SDL_mixer/index.html I also downloaded Spots SPFD and followed the hints including using the SDL configure script to no avail. More lines form the congif.log give a hint something is seriously wrong: /SDK/local/newlib/lib/libSDL_mixer.a(mixer.o): In function `Mix_GroupChannel': /Work/Development/Projects/Ports/SDL_mixer-1.2.11/mixer.c:1181: undefined reference to `SDL_LockAudio' /Work/Development/Projects/Ports/SDL_mixer-1.2.11/mixer.c:1183: undefined reference to `SDL_UnlockAudio' I also tried to compile SDL_Mix example source from os4depot. At first: make Makefile.aos4 all make: Nothing to be done for `Makefile.aos4'. gcc `sdl-config --libs` -lSDL_mixer -s -o mix mix.o sdl-config: Unknown command sdl-config failed returncode 10 Then: gmake: Nothing to be done for `Makefile.aos4'. gcc `sdl-config --libs` -lSDL_mixer -s -o mix mix.o ld: warning: libsmpeg-0.4.so, needed by /SDK/local/newlib/lib/libSDL_mixer.so, not found (try using -rpath or -rpath-link) ld: warning: libFLAC.so, needed by /SDK/local/newlib/lib/libSDL_mixer.so, not found (try using -rpath or -rpath-link) ld: warning: libogg.so, needed by /SDK/local/newlib/lib/libSDL_mixer.so, not found (try using -rpath or -rpath-link) ld: warning: libvorbisfile.so, needed by /SDK/local/newlib/lib/libSDL_mixer.so, not found (try using -rpath or -rpath-link) ld: warning: libvorbis.so, needed by /SDK/local/newlib/lib/libSDL_mixer.so, not found (try using -rpath or -rpath-link) ld: warning: libpthread.so, needed by /SDK/local/newlib/lib/libSDL_mixer.so, not found (try using -rpath or -rpath-link) ld: warning: libstdc++.so, needed by /SDK/local/newlib/lib/libSDL_mixer.so, not found (try using -rpath or -rpath-link) /SDK/local/newlib/lib/libSDL_mixer.so: undefined reference to `SMPEG_enablevideo' /SDK/local/newlib/lib/libSDL_mixer.so: undefined reference to `FLAC__stream_decoder_get_state' /SDK/local/newlib/lib/libSDL_mixer.so: undefined reference to `FLAC__stream_decoder_flush' /SDK/local/newlib/lib/libSDL_mixer.so: undefined reference to `FLAC__stream_decoder_seek_absolute' As you can see I am missing major files but I don't know what. I goto onto os4depot last night and updated all the related SDL libs I could find for the SDK. And it made no change! It has to be sometihng simple. What is going wrong? Do I need the latest SDK for it to work? I ahev version 53 according to my SDK PDF.
kas1e
kas1e's picture
Offline
Last seen: 3 weeks 4 days ago
Joined: 2010-11-30 15:30
@Hypex You need just add
@Hypex You need just add -lSDL to the configure script manually, or add it via CFLAGS when you run configure, because SDL_LockAuido and SDL_UnLockAudio are from plain sdl libary (libsdl.a if you use static version). And your line should be:
  1. g++ -o conftest -g -O2 conftest.cpp -lSDL_mixer -lsmpeg -lm -lvorbisfile -lvorbis -logg -lSDL -lstdc++
As for your mixer examples, they by some reassons tryes to compiles for you with sobjes usage (and not static), and because of that they want /SDK/local/newlib/lib/libSDL_mixer.so (check if you have it), as well as libSDL_mixer.so by itself want smpeg and flac libs. That is all easy of course, just follow the error logs, check what undefined, search in SDK in which libs that strings presents, and include them to linking lines. For that you have 2 ways as i say before: directly change configure, or provide necessary libs via CFLAGS (which will passed to configure as well) To add, if you want to compile SDL_Mixer to use with some of your projects, compile it staticaly and without pthread usage (as i do for myself lately), then you will not have any crashes realted to pthreads (which still happens from time to time).
hypex
hypex's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2011-09-09 16:20
@kas1e Thanks for the
@kas1e Thanks for the extensive reply. I have tried all you have suggested but I just can't get it to budge. I have given flags and libs to a configure script as well as hack them in there and it just won't work! Both for a configure needing Mixer and that OS4 example code. Nothing works! I also wondered which SDL Mixer do I install from OS4Depot? I examined both and selected what looked newer. I also updated my SDK and copied my Local back over. But since the new Local was already full of stuff I had trouble copying it. Wish Amiga had a merge or copy newer files program! Both DirOpus and WB failed me. Hate it when WB gives up immediately on a duplicate name! Argh! So then reinstalled Mixer and other SDL stuff. No change. Looks like I will have to investigate static libs. But I wonder why not even the OS4 example compiles out of the box nor why they don't tell you how to. Looks like this SDL and Mixer needs a lot of work to bring it up to scratch. No point porting these if they don't work after installing and still don't work after hacking around! :-?
kas1e
kas1e's picture
Offline
Last seen: 3 weeks 4 days ago
Joined: 2010-11-30 15:30
@Hypex Thanks for the
@Hypex
Thanks for the extensive reply. I have tried all you have suggested but I just can't get it to budge. I have given flags and libs to a configure script as well as hack them in there and it just won't work!
After any new action you do, check configure.log , and see, what errors it reports. And include library which containt the undefined errors.
Both for a configure needing Mixer and that OS4 example code. Nothing works! I also wondered which SDL Mixer do I install from OS4Depot? I examined both and selected what looked newer.
Use ./configure --help, it will show you what you can disable and/or enable. I somehow sure there should be something like "disable-test" or kind.
So then reinstalled Mixer and other SDL stuff. No change. Looks like I will have to investigate static libs. But I wonder why not even the OS4 example compiles out of the box nor why they don't tell you how to.
If you want to fix things normally, and make everything works, you need calm the mind, and step by step read what errors you have, and fix them step by step. I.e. what you mean by "nothing works" and "no change" ? When you do what ? Did you add static flags to compile everything statically ? How you run configure ? Did you run it at all, or trying to use makefiles right after unpacking ? Did your sdk works at all ? Can you create simple hello_world already ? Best way its just write what you do exactly, and step by step. I.e. like: 1. i download that from that place 2. i unpack it like this 3. i run shell, and run (or not) sh in it 4. i go to that or that directory 5. i run ./configure with that and that parameters, because i think that and that is need it 6. after running i have that and that error 7. i check that and that error, add to that and that place that and that flag/libs and have that and that error, what wrong ? Then, we can help. Because without normal and step-by-step details, no one can help. Better just download SDL_mixer from official page, and make your own build, without anything else. And to add, when you compile your own library, that does not mean that it automatically will install in the sdk. When you make your own libsdl_mixer.a (for example) you should yourself copy that to the sdk/commonlib/newlib or whatever where your newlib libs placed. Sometime test examples take the lib from the same directory where library compiled, sometime not. That all need to check manually, and put library to the right place, to make linker happy.
hypex
hypex's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2011-09-09 16:20
@kas1e After any new action
@kas1e
After any new action you do, check configure.log , and see, what errors it reports. And include library which containt the undefined errors.
In my case it hadn't changed.
Use ./configure --help, it will show you what you can disable and/or enable. I somehow sure there should be something like "disable-test" or kind.
That gives info yes. BTW I usually run without the "./" as that doesn't work with tab completion.
If you want to fix things normally, and make everything works, you need calm the mind, and step by step read what errors you have, and fix them step by step. I.e. what you mean by "nothing works" and "no change" ? When you do what ?
I realise how that looks and was as informative as an OS4 changelog. :-P And as an OS4 betetester I should know better. ;-) Sorry. I'd been away from home so unable to work at it and wanted to give you some feedback. Now what I did was locate the LIBS in the configure script at the point where it tests SDL_Mixer and added the extra libs in there. I also made sure the required lib was installed in my SDK. It did look like it made a difference but would always break at the same functions. I then saved it and to execute it in my shell I ran "sh" to get into ABC shell and then "configure". But I have good news! I solved it! :Dance I wass starting getting somewhere when I noticed I had missed something: -lSDL! :-o It worked a lot better but still broke. What looked like MikMod and FLAC. I reinstalled MikMod and then I managed to hazard a guess as to what the libs where called. I guessed -lmikmod and-lflac correctly. I was almost done but it still got stuck at sone point. It turned out to be PThreads. So I finally added -lpthreads and configure made it all the way through! Hooray! :-D Here is the final working line: LIBS="-lSDL_mixer -lsmpeg -lm -lvorbisfile -lvorbis -logg -lmikmod -lflac -lSDL -lpthread -lstdc++ $LIBS" So I needed all that just for lSDL_mixer! I then tested the SDL_Mix example and no: Still broken. Lacking instructions that example. But that didn't matter. I then ran "make" and all was going well until the source couldn't find "SDL_net.h". Turned out on OS4 we rightly (IMHO) have them in a SDL directory but this expected it to be in the root includes. That doesn't sound correct. But I copied it a level below and the compile worked! :-) Then I found the makefile recompiles all objects regardless when it's ran... Anyway thanks a lot for your help. Got it all sorted now. :-) The configure script that is... ;-)
Log in or register to post comments