On Sun, Aug 17, 2003 at 04:35:12PM +0200, Ingo Ruhnke wrote: > "Adam D. Moss" <firstname.lastname@example.org> writes: > > > By the way, what specific problems are you seeing with dynamically- > > linked GL libs that are clearly attributable to GL libs? I would > > hope that at this time it's perfectly sane to just dynamically- link > > against libGL, without resorting to dlopen'ing. The only problems > > you should see in this case would be if you were using a (say) >=1.2 > > version of OpenGL to build with where some symbols that previously > > belonged to extensions moved into the headers, but the user is using > > an earlier version. > > The problem is that if I link dynamic against the GL libs, that I also > have to dynamic link against libc. Which makes the binary unusable on > systems that have an older version of libc around than I have. Beside > that dynamic linking against GL seems to work fine, but the libc issue > doesn't really make it a useable solution if the resulting binary will > only work on 50% of the systems out there. > It is possible, though for reasons discussed elsewhere int this thread undesirable, to link to libc statically, and still link dynamically to another library, like OpenGL. You do this by passing the flag -nodefaultlibs to the linker so that it does not try to link libc itself, and list the .a files for libc and related libraries on the command line, rather that providing them as -l.... This causes the linker to do a normal dynamic link, but forces libc to be linked statically. You will need to give the full path to the .a file for each library you want linked statically, and you will also need to give the path to some additional libraries if you are using certain versions of gcc. Here is a trivial example of what a link command line might look like: gcc -o testGL testGL.o -lGL /usr/lib/libSDL.a /usr/lib/libc.a \ /usr/lib/gcc-lib/i386-redhat-linux/3.2/libgcc.a If you are using SDL you may need to add the libraries that SDL requires. You will notice that libgcc is in a compiler dependant location, so you will need to search for it. Al -- Alistair Riddoch email@example.com http://www.zepler.org/~alriddoch/ It's GNU/Linux dammit!
Description: PGP signature