[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Static Linking Throuble with OpenGL



Hiho,

I am currently struggeling to get a static binary for a game of mine
build. For games that just use X11 it wasn't too difficult, I just had
to add '-static' and all the required libraries (and libraries which
where required by libraries) and that would produce a working static
binary which ran on all x86 Linux systems so far, I didn't had a
single bug report. But now when it comes to OpenGL which has to be
linked dynamically as far as I know, this whole process no longer
works all that easily. What I do is like this:

$(CXX) -s -nodefaultlibs -o game sprite.o foo.o ...
       -Wl,-Bstatic [all libraries] \
       -Wl,-Bdynamic -lGL -lc

This produces a binary that only depends on libc and OpenGL, which is
fine and works on many systems, but by far not all. On systems which
have older glibc's the binary will fails to run and aborts directly at
startup.

On the other side if I try to also link also libc statically it won't
work at all, the resulting binary will installly crash at startup
somewhere in dlopen(), so a static linked libc together with a dynamic
OpenGL doesn't really seem to work.

So does anybody know how I can produce a binary that uses OpenGL that
will work on all x86 Linux systems out there or at least the ones that
have a correct OpenGL setup?

-- 
WWW:      http://pingus.seul.org/~grumbel/ 
Games:    http://pingus.seul.org/~grumbel/gamedesigns/
JabberID: grumbel@jabber.org 
ICQ:      59461927