These are real messy to use, as far as I know it is an all-or-nothing flag
to the linker, --static really links all libs statically (if the static
versions are available).
What one would normally like to do would be:
gcc ... -lfoo --static -lbar --shared -lbaz
assuming switches progress from left to right to flag that one (and only
one) library should be linked in statically.
This does not work, atleaste when I tried (could be that I'm unaware of
something basic here.)
The only approach I ever found was to remove the dynamic libraries (rm -f
/usr/lib/libfoo.so*) and link as usual. Since the dynamic libs are
missing, the linker will pick up the static ones instead.
I wonder of it'll really work to have both static and dynamic libs in the
same file tree and try to link the static version, but please enlighten
Of course as long as you're only using one single library, --static works
OK but with more complex programs it's just one big mess. Another reason
not to use it IMHO.
fedora-extras-list mailing list