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
instructions.
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!
http://forums.mcafeehelp.com/viewtopic.php?t=6318
Basically, after the lib is compiled, you have to type:
install_name_tool -id @executable_path/libSDL.dylib libSDL.dylib
(I renamed libSDL-1.2.0.7.1.dylib 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
flags.)
The otool tool can be used to check that the exe is linked against the
correct lib:
otool -L testprogram
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
:-}.
Thanks,On 17/01/2005, Matthew Cox, you wrote:
Olivier.
Please remove “.ARGL.invalid” from my email when replying.
Incoming HTML mails are automatically deleted.