[email protected]
[Top] [All Lists]

Re: static libs ... again

Subject: Re: static libs ... again
From: Linus Walleij
Date: Wed, 22 Feb 2006 11:35:35 +0100 CET
gcc --shared/--static.

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

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
[email protected]

<Prev in Thread] Current Thread [Next in Thread>