new upload: fped_0.0+r5983-1

Bas Wijnen wijnen at debian.org
Fri Oct 15 15:42:43 EDT 2010


Op 15-10-10 03:12, Werner Almesberger schreef:
> Bas Wijnen wrote:
>> Things get annoyingly complex when inline functions from header files
>> call library functions.
> 
> Hmm, why would this be more complex (for run-time dependencies) than
> just calling those library functions directly ?

If you compute the dependencies automatically, there is no problem.
However, if you manually decide which libraries to link to, and you
think you only directly use liba, but through inline functions you do
call functions from libb, you do need to link directly to libb as well,
even though you don't realize it.

These problems are pretty much the reason pkg-config exists, AFAIK.
That, and buggy platforms which require executables that indirectly use
a library to link directly to it.

>>> Thinking of it, would just putting LDFLAGS into the Makefile, and
>>> invoking a build with  make LDFLAGS_DEBIAN=-Wl,--as-needed  work ?
>>
>> I'm not sure what you are trying to do, but it is almost certainly a bad
>> idea. ;-)
> 
> Heh :-) It's a bit more complicated, though. First of all, I generally
> don't like things that produce lots of warnings, because that can mask
> real problems.

I agree with that. I try to get rid of all warning normally, because if
you allow some, they accumulate and at some point there are more than
you can handle, without you noticing it.

I want to understand every warning I ignore, and I don't want to spend
my brain power on remembering why a warning should be ignored. :-)

> By letting the package build process (doesn't actually have to be
> specific to Debian) manipulate the LDFLAGS, this mechanism would be
> hidden from fped, yet the objective of avoiding unnecessary run-time
> dependencies would be achieved.

Why should it happen when building a package, but not when building the
program from source? IMO a package should only do things to integrate
the program into the system; I see that this is related to that, but not
having needless dependencies is always a good idea, not only when
installing as a package.

> What I don't like is that it pinches the abstraction provided by
> things like pkg-config. The whole purpose of pkg-config is that one
> should not look at what libraries are used underneath. But this
> warning exposes them.

I agree that this should not be happening. It is a bug in pkg-config,
because it shouldn't list those libraries on the commandline. However,
here comes the inline functions called from include files problem: if
that happens, they are used directly, and should be listed on the
commandline. Pkg-config cannot know if those functions are called or
not. That problem is solved by --as-needed.

> That by itself isn't so bad, because it's a message for the package
> maker, who has an interest in understanding and avoiding this sort of
> unintended consequences.

I don't think this is any more the responsibility of the package builder
as it is of the upstream developer. However, the proper fix is neither
in the package, nor in the source. It's in pkg-config, or perhaps in ld
(which should have --as-needed on by default, or at least give
pkg-config the option to enable it for those libraries that are
automatically added).

> Worse yet, the semantics of the fix are quite complex. This is what
> makes me reluctant to have such a "magic" option in the Makefile.
> 
> What would help is a distribution-neutral description of the role of
> --as-needed and its possible ramifications I could link to. Gentoo
> have something [1] reasonably understandable (it would be nice to
> have a bit more background on DT_NEEDED and a mention of how to
> verify the effect of the option, though) but there's a lot of
> material that's Gentoo-specific.
> 
> Are you aware of any suitable description ?
> 
> [1] http://www.gentoo.org/proj/en/qa/asneeded.xml

Well, it looks like a very nice article to me. Only the paragraph about
"Properly filtering --as-needed" is very gentoo-specific, the rest seems
to work everywhere, or at least it is understandable how to apply it for
other distributions.

> I guess life would (eventually) be easier if ld just defaulted to
> --as-needed :-)

Yes. Except that, as they note, it is annoying that you need to get the
order on the commandline right. In rare cases (when a symbol is defined
in multiple libraries) this is a problem for the normal case as well,
though.

By the way, you can set it as default for your own compiler, as
explained in the article. That doesn't work for package builds, though.

Thanks,
Bas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.en.qi-hardware.com/pipermail/discussion/attachments/20101015/ef2c2310/attachment.pgp>


More information about the discussion mailing list


interactive