www.digitalmars.com         C & C++   DMDScript  

D.gnu - Problems with SDL_Mixer on Mac

reply Mark Harviston <infinull gmail.com> writes:
I downloaded the files from Anders's website and modified the code for a 
game I am making. (its called Ugly Tank, if you care) and now I want to 
add sound. I promptly imported sdl.audio, and sdl.mixer.
sdl.audio imported fine.
sdl.mixer gave a link error:
/usr/bin/ld: Undefined Symbols:
--ModuleInfo_5mixer
collect2 ld returned with 1 exit status

I know SDL_Mixer works, because I loaded the aliens example from the SDL 
website, and it uses SDL_Mixer.

I know what the problem is now(the above is still valid)
the makefile is linking to the Framework and the *.os in the sdl/* local 
directory.
If i link (-L/sw/lib) to the fink librarys, the mixer problems would 
seem to go away, but I am left with "can't locate file for: -lSDL_d",
so how do I get both in the same directory?
can I copy the SDL_Mixer stuff from /sw/lib/?
what files do I copy?
thanks in advance.
--Mark
Mar 15 2006
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Mark Harviston wrote:

 sdl.audio imported fine.
 sdl.mixer gave a link error:
 /usr/bin/ld: Undefined Symbols:
 --ModuleInfo_5mixer
 collect2 ld returned with 1 exit status
That would be a symbol from the D code.
 I know SDL_Mixer works, because I loaded the aliens example from the SDL 
 website, and it uses SDL_Mixer.
 
 I know what the problem is now(the above is still valid)
 the makefile is linking to the Framework and the *.os in the sdl/* local 
 directory.
That should be OK.
 If i link (-L/sw/lib) to the fink librarys, the mixer problems would 
 seem to go away, but I am left with "can't locate file for: -lSDL_d",
 so how do I get both in the same directory?
You can add both of them, like this: -L . -L/sw/lib SDL_d was just a lib that I did for the D "sdl/*.o", so you could add the object files instead of that one.
 can I copy the SDL_Mixer stuff from /sw/lib/?
 what files do I copy?
Better to leave Fink's SDL_Mixer dylibs in /sw/lib, but you can copy the "libSDL_d.a" to /usr/local/lib ? Hopefully I'll get some time to clean this up soon.. --anders
Mar 15 2006
parent reply Mark Harviston <infinull gmail.com> writes:
Anders F Björklund wrote:
 Mark Harviston wrote:
 
 sdl.audio imported fine.
 sdl.mixer gave a link error:
 /usr/bin/ld: Undefined Symbols:
 --ModuleInfo_5mixer
 collect2 ld returned with 1 exit status
That would be a symbol from the D code.
 I know SDL_Mixer works, because I loaded the aliens example from the 
 SDL website, and it uses SDL_Mixer.

 I know what the problem is now(the above is still valid)
 the makefile is linking to the Framework and the *.os in the sdl/* 
 local directory.
That should be OK.
 If i link (-L/sw/lib) to the fink librarys, the mixer problems would 
 seem to go away, but I am left with "can't locate file for: -lSDL_d",
 so how do I get both in the same directory?
You can add both of them, like this: -L . -L/sw/lib SDL_d was just a lib that I did for the D "sdl/*.o", so you could add the object files instead of that one.
 can I copy the SDL_Mixer stuff from /sw/lib/?
 what files do I copy?
Better to leave Fink's SDL_Mixer dylibs in /sw/lib, but you can copy the "libSDL_d.a" to /usr/local/lib ? Hopefully I'll get some time to clean this up soon.. --anders
Thank you, but make LDFLAGS="-L/sw/lib/ -L. still gives me the __ModuleInfo_5mixer undefined error again I have tried many variations, like: make LDFLAGS="-L. -L./sdl/ -L/sw/lib" so maybe that is not the problem. ideas? like I said I know C++ programs can link to it, so theres gotta be a way for D programs to. --Mark
Mar 16 2006
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Mark Harviston wrote:

 Thank you, but
 make LDFLAGS="-L/sw/lib/ -L.
 still gives me the __ModuleInfo_5mixer undefined error again
 I have tried many variations, like:
 make LDFLAGS="-L. -L./sdl/ -L/sw/lib"
 so maybe that is not the problem.
 ideas?
Is the mixer.d actually *in* the D library ? Maybe you need another .o, beyond the .a ? (I think SDL_Mixer is an add-on to SDL, yes?) --anders
Mar 16 2006
parent Mark Harviston <infinull gmail.com> writes:
Anders F Björklund wrote:
 Mark Harviston wrote:
 
 Thank you, but
 make LDFLAGS="-L/sw/lib/ -L.
 still gives me the __ModuleInfo_5mixer undefined error again
 I have tried many variations, like:
 make LDFLAGS="-L. -L./sdl/ -L/sw/lib"
 so maybe that is not the problem.
 ideas?
Is the mixer.d actually *in* the D library ? Maybe you need another .o, beyond the .a ? (I think SDL_Mixer is an add-on to SDL, yes?) --anders
SDL Mixer is an addon. O.K. I added mixer.o to the .o list in the makefile I tried a make and a make LDFLAGS="-L. -L/sw/lib -lSDL_mixer" and low and behold it worked. my main problem there was I forgot the _ but I figured that out. Thanks for all the help, --Mark
Mar 16 2006