Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Dec 2012 11:56:43 +0100
From:      Baptiste Daroussin <bapt@freebsd.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        hackers@freebsd.org
Subject:   Re: Fix overlinking in base aka import pkgconf
Message-ID:  <20121215105643.GG18884@ithaqua.etoilebsd.net>
In-Reply-To: <20121215012233.GP71906@kib.kiev.ua>
References:  <20121214235418.GF18884@ithaqua.etoilebsd.net> <20121215012233.GP71906@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--HKEL+t8MFpg/ASTE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Dec 15, 2012 at 03:22:34AM +0200, Konstantin Belousov wrote:
> On Sat, Dec 15, 2012 at 12:54:19AM +0100, Baptiste Daroussin wrote:
> > Hi,
> >=20
> > Some of our binary are overlinked, the way we handle the linking doesn'=
t help
> > for that.
> What do you mean there ? Do you mean that some libraries specified for the
> linking stage of the final binary are not needed for the execution ?

I mean some library are registrer in the binary with DT_NEEDED tag where th=
ey
don't need to.

>=20
> >=20
> > On proposition could be to use pkgconf https://github.com/pkgconf/pkgco=
nf which
> > is BSD license pkg-config implementation 100% compatible with pkg-confi=
g.
> >=20
> > What I propose is to create a new PCADD variable for the Makefiles.
> >=20
> > PCADD will invoke pkgconf to gather the libraries and the cflags for a =
given
> > project.
> >=20
> > The second thing would be to create .pc files for all of our libraries.
> >=20
> > for example:
> > usr.bin/fstat dynamic build is overlinked
> And how this is better than just removing the unneeded library from
> the Makefile ?

In that case to statically build you need -lkvm -lutil -lprocstat but if you
build dynamically you will only need -lproctast meaning you don't need to be
directly linked to libutil and libkvm. This means a breakage of libutil will
only have inpact on procstat and no more on fstat for example.

>=20
> For the port consumption, I believe that the better solution is to provide
> a pack of the .pc files describing base libraries, most likely as port.

Yeah the port is another thing which yes can probably be done that way.

>=20
> Using .pc for the base system build is overkill, it does not add anything
> that cannot be accomplished by our existing build system. IMO.

Probably.
The thing is with pkgconf, fstat does not need to know that procstat
needs libkvm and libutil for static link, it just has to know it needs proc=
stat
and pkgconf does all the magic. and pkgconf is really small (only 48k on an
amd64 box)

Other solution would be to reinvent the same thing using our framework?
Maybe a LDSADD (LD STATIC ADD) to differenciate both?

regards,
Bapt

--HKEL+t8MFpg/ASTE
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iEYEARECAAYFAlDMV2sACgkQ8kTtMUmk6EywggCfcYWzp3/daYFKOwX3YD1gFgDK
rLIAn1iujMVzzxGDTw5iqpQfFlZVuiLe
=xxMg
-----END PGP SIGNATURE-----

--HKEL+t8MFpg/ASTE--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121215105643.GG18884>