[SDL] Re: SDL under Mac OS X

Olivier Fabre off at free.fr.ARGL.invalid
Tue Jan 18 01:07:21 PST 2005

Hello again,

Thanks a lot to everyone who answered! Your mails gave me hints about
what to look for... Unfortunately, as I don't know anything about linux
shared libraries, nor about OSX programming, I needed practical

Ryan's method seemed to be what I needed, but unfortunately I couldn't
make it work because libtool deletes the object files and so I couldn't
use them again to rebuild the lib with the -install-name parameter. I
tried (first) hacking the Makefile to change the install path there,
but after a few hours (finding that it was libtool that was used to
link the lib, trying to understand its doc...), I couldn't make it
work. I also tried modifying the libtool script with no luck.

Then I tried the "install_name_tool" way. I googled some more using
magical keywords like "executable_path" and "install_name_tool" and
finally found the answer... in the McAfee support forum!


Basically, after the lib is compiled, you have to type:

install_name_tool -id @executable_path/libSDL.dylib libSDL.dylib 

(I renamed libSDL- to libSDL.dylib in order to make room
for "@executable_path" since it is longer than "/usr/local/lib". It's
also easier to type ;) )

And then put this lib into the executable's directory and link against
it. (done by adding "-L." in front of "-L/usr/local/lib" in the linker

The otool tool can be used to check that the exe is linked against the
correct lib:

otool -L testprogram

On 17/01/2005, Matthew Cox, you wrote:

> I think that's precisely it. The people advocating the dylib approach
> tend to be people coming from a traditional unix environment. It
> sounds like the original poster was porting from Linux, so this is
> probably what will make more sense to him.

I fact, not at all. I originally wrote my game on Amiga (using the
AmigaOS API and MiniGL), then ported it to SDL/Win32, and now I'm
porting it to Mac OS X.

> Then of course there's the unix mindset of not really trusting
> anything you haven't compiled yourself

I would have been happier with a pre-built SDL for OS X, but I couldn't
find one on www.libsdl.org's downloads page. I don't remember exactly,
but I think I downloaded the framework thing, and then its installer
told me it had installed everything I didn't want and I had to use the
source distro to get what I wanted. At least, that's what I understood

Now it's time to build zlib, libpng, SDL_image and SDL_mixer, I guess

Please remove ".ARGL.invalid" from my email when replying.
Incoming HTML mails are automatically deleted.

More information about the SDL mailing list