[Top][All Lists]

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

Re: Avoid -Wl,--whole-archive

From: Bob Friesenhahn
Subject: Re: Avoid -Wl,--whole-archive
Date: Thu, 16 May 2019 10:00:53 -0500 (CDT)
User-agent: Alpine 2.20 (GSO 67 2015-01-07)

On Thu, 16 May 2019, Tim Rühsen wrote:


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

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 Friesenhahn
GraphicsMagick Maintainer,
Public Key,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]