[SDL] Compiling whoes - need a hint

Peter Mulholland darkmatter at freeuk.com
Wed Jul 19 16:44:43 PDT 2006


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 
offhand.

> Makes sense.
> 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.

Sure.

> After looking at all the libs I should find the one the provides
> XNextRequest.

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) 
dynamically.

Pete.





More information about the SDL mailing list