LD Changes To Implicit DSO Linking Update

Adam Williamson awilliam at redhat.com
Wed Feb 10 19:02:45 UTC 2010


On Wed, 2010-02-10 at 10:41 -0800, Roland McGrath wrote:
> > To answer the question, it works because the CFLAGS happen to be applied
> > to the linker command as well as the LDFLAGS. As Roland says, though,
> > adding it to CFLAGS is the wrongest fix, forcing it into LDFLAGS via the
> > spec file is slightly less wrong, but having the upstream code add the
> > flag properly during its configure stage is least wrong.
> 
> The main point of entirely pointless pedanticism I was making is that you
> really should put -lfoo at the end of a linking command line (after all the
> .o files), not at the beginning where ${LDFLAGS} usually goes.  

Well, I'd say it's at least as important that the fix should be done in
the appropriate place - the source code's configure step - and not
wedged into the spec file. And then, of course, it should be sent
upstream.

> For cases like this, it probably doesn't make a great deal of sense to use
> a configure test.  That is, the call to some X11* function is not
> conditional in the source, so -lX11 need not be conditional in the makefile.
> 
> When there is no true need to conditionalize anything, extra autoconf
> and/or pkg-config magic just makes everything more arcane for no reason.

The point of pkg-config isn't only (or even primarily) to
conditionalize. It's more to abstract the name, location, dependencies
and required flags of the library behind a single static thing (the
pkg-config file). So the necessary flags - or anything else pkg-config
provides - can be changed, if necessary, by the upstream project in a
single place (the .pc file) and all downstreams will automatically
inherit the change without having to touch anything. (If everything had
been using pkg-config for 20 years, for instance, it's likely much less
would be broken by this DSO change, because all the dependencies would
be declared in the upstream pc files and downstream projects wouldn't
have had a chance to forget about them :>)
-- 
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Fedora Talk: adamwill AT fedoraproject DOT org
http://www.happyassassin.net



More information about the devel mailing list