Re: static libs ... again

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Linus

--
fedora-extras-list mailing list
fedora-extras-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-extras-list

[Index of Archives]     [Fedora General Discussion]     [Fedora Art]     [Fedora Docs]     [Fedora Package Review]     [Fedora Desktop]     [Big List of Linux Books]     [Yosemite Backpacking]     [KDE Users]

  Powered by Linux