Re: Avoid -Wl,--whole-archive

Bob Friesenhahn <[email protected]>
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <[email protected]>
On Thu, 16 May 2019, Tim Rühsen wrote:

> Hi,
>
> at GNU Wget2 we are just splitting a (shared) library into several
> smaller ones, grouped by functionality.
>
> We depend on gnulib and have a single libgnu.a. Each of the shared
> libraries just need a certain set of functions from libgnu.a.
>
> To avoid adding everything from libgnu.a to each of the libraries, we
> would like to avoid "-Wl,--whole-archive ../lib/.libs/libgnu.a
> -Wl,--no-whole-archive".

There is no requirement to use "convenience" libraries.  People who do 
things due to "convenience" are often classified as "lazy". :-)

If you have time to re-do your build structure, then I recommend using 
a non-recursive build and explicitly listing the objects which are 
needed by each library in the single Makefile.  Objects common to 
multiple libraries will then be built just once and supplied to the 
linker as a list of object files rather than fed to libtool like an 
"archive" file which is then split into object files actually supplied 
to the linker.

Convenience libraries are evil.  Convenience libraries slow down your 
build process dramatically and they cause 'make' not to be aware of 
the actual underlying dependencies, so that it does much more work 
than is required each type you invoke 'make'.  If you can enumerate 
the actual dependencies in the Makefile and avoid needless 
intermediate product generation, then you will achive a maximally 
parallel build which builds much faster on modern systems.

If your project is already fully built, then typing 'make' again 
should return almost immediately without doing any work at all.  If 
your project does any work at all due to typing 'make' a second time, 
then it is defective.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt

_______________________________________________
https://lists.gnu.org/mailman/listinfo/libtool
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.