Re: -Wl,--as-needed considered possibly harmful
On Sun, Dec 09, 2007 at 03:47:52PM -0800, Steve Langasek wrote:
> > However, not all applications uses those symbols in their current code, so
> > they do not need to be linked against speex themselves.
> And therefore, the scripts generating dependency information for dynamically
> linking to libshout should *not* list libspeex or libtheora, and
> consequently there's no need for -Wl,--as-needed. (When statically linking,
> -Wl,--as-needed is also irrelevant, because unused symbols from static libs
> are already discarded.)
> > Of course, correct dependencies will be pulled when requesting libshout.
> No, currently the dependencies pulled in are overbroad. Please fix
> /usr/lib/pkgconfig/shout.pc to list the dependent libraries in
> "Requires.private", not in "Requires".
... also, -Wl,--as-needed is *not* a complete solution for the problems
caused by generating extra -l arguments. Every -lfoo option passed to the
linker requires the corresponding -dev package to be installed at build
time; while it is a bug if the -dev packages don't declare their
dependencies, the impact of such bugs (which do happen fairly often) would
be limited to static linking if appropriately-constructed .pc files were
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/