FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 12-10-2007, 05:57 PM
Stephen Gran
 
Default -Wl,--as-needed considered possibly harmful

This one time, at band camp, Michael Poole said:
> What happens for a user who (however absurd or insane he might be to
> try this with gtk+) tries to link his application statically?
>
> Perhaps the "absurd and wrong" part is that pkg-config does not
> provide a way to distinguish between use cases, and that the name for
> the current behavior should also be --static-libs rather than --libs,
> but there is a good reason to provide the transitive closure of
> dependencies for a package *somewhere* in pkg-config.

That is supported in pkg-config, but no upstream I've ever met seems to
understand it yet.
--
-----------------------------------------------------------------
| ,'`. Stephen Gran |
| : :' : sgran@debian.org |
| `. `' Debian user, admin, and developer |
| `- http://www.debian.org |
-----------------------------------------------------------------
 
Old 12-10-2007, 06:00 PM
Daniel Macks
 
Default -Wl,--as-needed considered possibly harmful

On Mon, Dec 10, 2007 at 01:47:15PM -0500, Michael Poole wrote:
> Steve Langasek writes:
> >>
> >> For example, pkg-config --libs gtk+-x11-2.0 will return, among others,
> >> -lglib-2.0 and -lm. And this is perfectly intentional.
> >
> > Just because it's intentional doesn't mean it isn't absurd and wrong.
>
> What happens for a user who (however absurd or insane he might be to
> try this with gtk+) tries to link his application statically?
>
> Perhaps the "absurd and wrong" part is that pkg-config does not
> provide a way to distinguish between use cases, and that the name for
> the current behavior should also be --static-libs rather than --libs,
> but there is a good reason to provide the transitive closure of
> dependencies for a package *somewhere* in pkg-config.

pkg-config *does* have a --static flag, which does appear to cause
--libs to emit Libs.private and other things that would normally be
handled by the dynamic-linking of shared libs.

dan


--
Daniel Macks
dmacks@netspace.org
http://www.netspace.org/~dmacks


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 12-10-2007, 06:03 PM
Pierre Habouzit
 
Default -Wl,--as-needed considered possibly harmful

On Mon, Dec 10, 2007 at 06:47:15PM +0000, Michael Poole wrote:
> Steve Langasek writes:
>
> > On Sun, Dec 09, 2007 at 07:23:00PM +0100, Josselin Mouette wrote:
> >
> >> Le dimanche 09 décembre 2007 à 19:11 +0100, Bernhard R. Link a écrit :
> >> > Just curing the symptoms instead of the problems will not help to get
> >> > there any sooner.
> >
> >> What if there is no problem?
> >
> >> For example, pkg-config --libs gtk+-x11-2.0 will return, among others,
> >> -lglib-2.0 and -lm. And this is perfectly intentional.
> >
> > Just because it's intentional doesn't mean it isn't absurd and wrong.
>
> What happens for a user who (however absurd or insane he might be to
> try this with gtk+) tries to link his application statically?
>
> Perhaps the "absurd and wrong" part is that pkg-config does not
> provide a way to distinguish between use cases, and that the name for

Wrong, please read pkg-config(1) and think again.

$ pkg-config tokyocabinet --libs
-ltokyocabinet
$ pkg-config tokyocabinet --libs --static
-ltokyocabinet -lz -lpthread -lm -lc
$ grep Libs /usr/lib/pkgconfig/tokyocabinet.pc
Libs: -L${libdir} -ltokyocabinet
Libs.private: -lz -lpthread -lm -lc


pkg-config *is* perfectly suited for that matter actually, and
"broken" pkgconfig upstreams are this trivial to fix. My upstream for
tokyocabinet uses in a tokyocabinet.pc.in:
Libs: -L${libdir} -ltokyocabinet @LIBS@
the fix is just to put the @LIBS@ onto Libs.private and be done with it.
Upstreams using pkg-config are actually the first _easy_ targets to fix
the dependency issues _they_ generate in others binaries. And there is
no reason no to fix those when it's easy to do so.

--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
 
Old 12-10-2007, 06:10 PM
Steve Langasek
 
Default -Wl,--as-needed considered possibly harmful

On Mon, Dec 10, 2007 at 01:47:15PM -0500, Michael Poole wrote:
> Steve Langasek writes:

> > On Sun, Dec 09, 2007 at 07:23:00PM +0100, Josselin Mouette wrote:

> >> Le dimanche 09 décembre 2007 à 19:11 +0100, Bernhard R. Link a écrit :
> >> > Just curing the symptoms instead of the problems will not help to get
> >> > there any sooner.

> >> What if there is no problem?

> >> For example, pkg-config --libs gtk+-x11-2.0 will return, among others,
> >> -lglib-2.0 and -lm. And this is perfectly intentional.

> > Just because it's intentional doesn't mean it isn't absurd and wrong.

> What happens for a user who (however absurd or insane he might be to
> try this with gtk+) tries to link his application statically?

Not that you should link statically with gtk (this yields the classic
problem of internal ABI skew when statically linking with a library that
uses dlopen), but pkg-config --static does exactly this.

--
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/
slangasek@ubuntu.com vorlon@debian.org


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 12-10-2007, 06:23 PM
Michael Poole
 
Default -Wl,--as-needed considered possibly harmful

Stephen Gran writes:

> This one time, at band camp, Michael Poole said:
>> What happens for a user who (however absurd or insane he might be to
>> try this with gtk+) tries to link his application statically?
>>
>> Perhaps the "absurd and wrong" part is that pkg-config does not
>> provide a way to distinguish between use cases, and that the name for
>> the current behavior should also be --static-libs rather than --libs,
>> but there is a good reason to provide the transitive closure of
>> dependencies for a package *somewhere* in pkg-config.
>
> That is supported in pkg-config, but no upstream I've ever met seems to
> understand it yet.

Ah, I see. I overlooked the --static flag to pkg-config because (case
in point) "pkg-config --libs gtk+-2.0" only misses seven of the
libraries that the --static version uses. I would guess this is
because "Requires.private" is not mentioned in the pkg-config man
page. At least on my system, Libs.private seems to be used correctly
by most or all .pc files, but Requires.private use is spotty.

Thank you for highlighting that.

Michael Poole


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 12-10-2007, 07:16 PM
Hendrik Sattler
 
Default -Wl,--as-needed considered possibly harmful

Am Montag 10 Dezember 2007 schrieb Michael Poole:
> Stephen Gran writes:
> > This one time, at band camp, Michael Poole said:
> >> What happens for a user who (however absurd or insane he might be to
> >> try this with gtk+) tries to link his application statically?
> >>
> >> Perhaps the "absurd and wrong" part is that pkg-config does not
> >> provide a way to distinguish between use cases, and that the name for
> >> the current behavior should also be --static-libs rather than --libs,
> >> but there is a good reason to provide the transitive closure of
> >> dependencies for a package *somewhere* in pkg-config.
> >
> > That is supported in pkg-config, but no upstream I've ever met seems to
> > understand it yet.
>
> Ah, I see. I overlooked the --static flag to pkg-config because (case
> in point) "pkg-config --libs gtk+-2.0" only misses seven of the
> libraries that the --static version uses. I would guess this is
> because "Requires.private" is not mentioned in the pkg-config man
> page. At least on my system, Libs.private seems to be used correctly
> by most or all .pc files, but Requires.private use is spotty.

The flaw in the documentation is surely the part to blame here.
Requires.Private works but is not mentioned anywhere. Neither is the --static
option in the SYNOPSIS part of the man page.
Not many use undocumented stuff.

HS


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 12-10-2007, 07:47 PM
Simon Richter
 
Default -Wl,--as-needed considered possibly harmful

Hi,

Josselin Mouette wrote:


No, what can be done is to fix upstream's broken declaration that 'you can
assume glib functions are available when doing "#include <gtk/gtk.h>"'. It
doesn't follow that just because this works in practice, it should be a
supported usage.



When many of the types used by GTK+ are those provided by GLib, it
sounds wrong to ask developers to include the GLib headers to have these
types available.


If it is really expected that type declarations are to be shared between
a program and a library, then the program becomes dependent on the
library's ABI without this dependency being formally expressed in any
usable form, which is broken in and by itself.


GTK needs to provide its own definitions of types and not expose
interfaces it does not control.


Simon


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 12-10-2007, 08:10 PM
Pierre Habouzit
 
Default -Wl,--as-needed considered possibly harmful

On Mon, Dec 10, 2007 at 08:16:10PM +0000, Hendrik Sattler wrote:
> Am Montag 10 Dezember 2007 schrieb Michael Poole:
> > Stephen Gran writes:
> > > This one time, at band camp, Michael Poole said:
> > >> What happens for a user who (however absurd or insane he might be to
> > >> try this with gtk+) tries to link his application statically?
> > >>
> > >> Perhaps the "absurd and wrong" part is that pkg-config does not
> > >> provide a way to distinguish between use cases, and that the name for
> > >> the current behavior should also be --static-libs rather than --libs,
> > >> but there is a good reason to provide the transitive closure of
> > >> dependencies for a package *somewhere* in pkg-config.
> > >
> > > That is supported in pkg-config, but no upstream I've ever met seems to
> > > understand it yet.
> >
> > Ah, I see. I overlooked the --static flag to pkg-config because (case
> > in point) "pkg-config --libs gtk+-2.0" only misses seven of the
> > libraries that the --static version uses. I would guess this is
> > because "Requires.private" is not mentioned in the pkg-config man
> > page. At least on my system, Libs.private seems to be used correctly
> > by most or all .pc files, but Requires.private use is spotty.
>
> The flaw in the documentation is surely the part to blame here.
> Requires.Private works but is not mentioned anywhere. Neither is the --static
> option in the SYNOPSIS part of the man page.
> Not many use undocumented stuff.

You're kidding ? If someone that produces libraries stop at the SYNOPSIS
section while reading documentation, he's a moron. The pkg-config tool
has a very concise documentation that says it all, --static is
documented in the OPTIONS section, and Requires, Libs, Libs.private in
METADATA FILE SYNTAX where due. Calling it undocumented is just either
bad faith or well, I can't see what else it can be in fact.


--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
 
Old 12-10-2007, 08:34 PM
Neil Williams
 
Default -Wl,--as-needed considered possibly harmful

On Mon, 10 Dec 2007 22:10:49 +0100
Pierre Habouzit <madcoder@debian.org> wrote:

> > > > That is supported in pkg-config, but no upstream I've ever met seems to
> > > > understand it yet.
> > >
> > > Ah, I see. I overlooked the --static flag to pkg-config because (case
> > > in point) "pkg-config --libs gtk+-2.0" only misses seven of the
> > > libraries that the --static version uses. I would guess this is
> > > because "Requires.private" is not mentioned in the pkg-config man
> > > page. At least on my system, Libs.private seems to be used correctly
> > > by most or all .pc files, but Requires.private use is spotty.
> >
> > The flaw in the documentation is surely the part to blame here.
> > Requires.Private works but is not mentioned anywhere. Neither is the --static
> > option in the SYNOPSIS part of the man page.
> > Not many use undocumented stuff.
>
> You're kidding ? If someone that produces libraries stop at the SYNOPSIS
> section while reading documentation, he's a moron. The pkg-config tool
> has a very concise documentation that says it all, --static is
> documented in the OPTIONS section, and Requires, Libs, Libs.private in
> METADATA FILE SYNTAX where due. Calling it undocumented is just either
> bad faith or well, I can't see what else it can be in fact.

What *is* missing is documentation of Requires.private:

--

Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/
 
Old 12-10-2007, 11:21 PM
Pavlov Konstantin
 
Default -Wl,--as-needed considered possibly harmful

On Mon, Dec 10, 2007 at 12:35:11AM -0300, Felipe Sateler wrote:
> Steve Langasek wrote:
>
> > ... 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
> > available.
>
> Note that pkgconfig is not the only problem here. Some extra links arise
> from the fact that several utilities or plugins for an application are
> built with the same "environment" (ie: the same flags), and not all of them
> require all the linked libraries. Of course, one could argue that fixing
> the build script is the way to go, but sometimes it is not trivial to do
> that (badly crafted or unmaintained build scripts tend to be quite ugly).

However, most of them are fixable. The only two problems we (ALT) had/have
with default --as-needed were mpeg4ip suit and net-snmp (though it's being
fixed already).

But again, not every upstream author accepts changes to .pc; but i've
never seen one not wanting to fix a build system.

--
ALT Linux Team,
ALT Linux Sisyphus project,
http://www.altlinux.com
 

Thread Tools




All times are GMT. The time now is 11:00 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org