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

Re: RFS: avant-window-navigator 0.2.1



Thanks a lot Cyril for this explanation, it makes more sense now :)
Using -Wl,--as-needed, I reduce the depends for 1 binary, but it's seems
not good for one other.
But I'll try to correct configure/Makefile directly, since I begin to
understand this strange thing that is autotools :)

-- 
Kind regards,
Julien Lavergne
jabber :  gilir@im.apinc.org

On dim, 2008-02-03 at 20:21 +0100, Cyril Brulebois wrote:
> On 03/02/2008, Julien Lavergne wrote:
> > That's something I wanted to do, but I didn't find a good way to do
> > that. I tried to replace ${shlibs:Depends} with only necessary
> > library, but dpkg-shlibdeps still get the same warnings.
> 
> Oh, no, you definitely don't want to touch that!
> 
> The idea is to get rid of extra/unneeded “-lfoo -lbar …” in the
> upstream Makefile, so as to link only against the libraries that are
> actually used.
> 
> Sometimes, just deleting an -lfoo would do. But more commonly, the
> build system doesn't allow you to use fine-grained library
> dependencies. That's where LDFLAGS=-Wl,--as-needed is your friend,
> since it tells the linker to forget about the unused libraries
> (resulting in less NEEDED entries, and happy dpkg-shlibdeps).
> 
> *BUT* that might break the resulting binaries, since (depending on
> various things, like build/link options), you may end up with
> undefined references, which result in runtime crashes.
> 
> To avoid that, you probably want to use another LDFLAG(S):
> -Wl,-z,defs, which explicitely forbids such undefined references.
> 
> Note that this might still break the build system, but that *is* a
> good thing. Usually, the problem is that the intermediate builds are
> broken, since the resolution of undefined references is (again, in
> some conditions) postponed to the final linking. By using this option,
> you explicitely forbid any single undefined reference (including in
> the intermediate targets), which means that you might sometimes have
> to modify the Makefiles to add some -lfoo or -lbar, or e.g. add
> TARGET_LINK_LIBRARIES() in cmake build systems.
> 
> That's a bit of work, but you'll probably end up with less
> dependencies (expressed in less Depends:), which is obviously
> (installed size, testing migration, etc.) a good thing.
> 
> Cheers,
> 



Reply to: