Thanks for your hints - but I still need some help.
I’m compiling a commercial game for PowerPC Linux.
The game uses SDL.
The dynamic compiled version of the game runs fine.
I’m afraid to ship a dynamic game version as I fear that it will not
work at the users place.
Somehow the static compiles segfault on some machines.
Reason is why I fear to ship dynamic builds:
The game uses a number of libs: SDL, vorbis, theora, ogg.
And I have noticed that some (newer) versions of libSDL
create GFX errors in the game. I have not yet analysed this one, but it
looks like one column is blitted to much. Could be a clipping issue.
Because of this I thought compiling the game as static
is the way to guarantee that the game always works.
Maybe another idea is better?
Maybe adding of the libs into ther game folder might work if I figure
how to change the library path.
My big und confusing problem is that the static game version
runs on two test machines but segfaults on the machine where I have
Can someone explain this?
I noticed that the static game does a lot of fopen
on libs, it looks like it wants to load them.
This puzzles me.
I would have thought that all the libs are compiled in
and that it does not need to fopen them on disk anymore.
Can someone explain this?
Do I need to build SDL in some special way?
Currently I just did a ./configure as I was
not sure what feature I can savely disable in SDL.
Here is my compile line maybe someone want to comment:
g++ -o robin libgame.a -static -L. -ljpg -lsbng ‘sdl-config
–static-libs’ ‘freetype-config -libs’ -ltheora -lvorbis -logg -lSDL
I tried as well only including SDL and theora and vorbis
by using -WL,-Bstatic … and -WL,-Bdynamic
so that X11 and the other libs are used dynamicly.
But this version still segfaults on my buildmachine.
Many in advance thanks for your help!!!
Peter Mulholland wrote:> Gunnar von Boehn wrote:
Because I want to guarantee that the application
is able to work out of the box for the user.
Without the need to install many libs like:
libvorbis, libsdl, libtheora etc.
Makes sense doesn’t it?
In my opinion the best way to do this is to make your exe look in the
current folder for the libs, and bundle the libs with your exe. That
way, should there be a bugfix for SDL etc the user can apply it without
having to rebuild your exe (assuming it’s open source). If the user
feels that using his distro’s version is better, they can delete the
bundled copies and the exe will automatically use the system installed ones.
There are switches you can feed to the linker which make it add library
search paths into the executable, but I can’t remember what they are
I assume after compiling SDL I can use ldd to see which libs it depends
and use ldd again on those libs and so on and so forth.
After looking at all the libs I should find the one the provides
At a guess it’s some X11 lib. You won’t want to statically link that !
I am guessing that what you’re doing here is passing -static to gcc at
the link stage, which will then want to link EVERYTHING statically. This
is a total pain. What you will need to do is use -Wl,-static and
-Wl,-dynamic to link some libs statically, and others (like X11)
SDL mailing list
SDL at libsdl.org