Try using LD_PRELOAD="./libs/libSDL.so ./libs/libSDL_mixer.so ./libs/libSDL_image.so"
do “man ld.so” for more info on the LD_* env vars.
in a script to run the game, you might name the game something like game.exe (I know it’s not a win32 exe file!)
and then you can name the script “game”, and do a chmod a+x game
the script would be something like:
--------------snip--------------------
#!/bin/sh
EXE=./game.exe
cd "dirname \"$0\"
“
if [ ! -x “$EXE” ] ; then
FULLEXE=”which \"$EXE\"
“
cd “dirname \"$FULLEXE\"
“
fi
if [ ! -x “$EXE” ] ; then
echo “Cannot find where $EXE is located!” >&2
exit 1
fi
export LD_PRELOAD=”./libs/libSDL.so ./libs/libSDL_mixer.so ./libs/libSDL_image.so"
exec “$EXE” ${1:+”$@”}
--------------snip--------------------
and that’s it…
change the “game.exe” on line 2 to the real name of the binary.
this script works for “./game”, “/path/to/game”, or just “game” when it’s found by the shell through $PATH .
you can check out any release of unreal tournament for linux, as they use a startup script too.
-LIM-
Olivier Fabre wrote:> Hello,
Sorry for the slight off topic, but I want to include SDL, SDL_mixer and
SDL_image in the directory of my game and link with these libs instead
of the libs in /usr/lib/. This is under Linux PPC. I spent sevaral
hours searching, but haven’t found how to do this yet.
I have tried the -rpath ./libs thing when linking, but ld returns an
error message “./libs unrecognized file format” (IIRC).
There is also the $LD_LIBRARY_PATH thing, but I don’t like this solution
and AFAIK it requires an absolute path.
Then I tried linking with -L./libs -lSDL etc., but that doesn’t work and
the exe is linked with /usr/lib/libSDL-1.2.so etc. even though I have
copied libSDL.so in ./libs/ ! There’s something I don’t understand
here.
Please help!
Thanks,