On Sun, 5 Apr 2020 17:20:07 +0000
Peter Stuge <[email protected]> wrote:

> James Le Cuirot wrote:
> > Damn, I realised just as I hit send that there's a caveat here and
> > that's sub-dependencies. If you're building a partially static binary
> > then I think you're okay. A fully static binary obviously needs all its
> > dependencies to be static and that includes any sub-dependencies.  
> 
> Note that there isn't really a way to express "partially static" to the
> toolchain when building a binary.
> 
> If you link a binary -static then that is always "fully static". No .so
> will satisfy any -l options.
> 
> The only way a "partially static" binary gets created is when linking
> *without* -static but some -l libraries only exist as static libraries,
> or if a library/object archive is specified with full .a filename,
> without using -l.
> 
> And "partially static" also only means that some dependencies were
> included into the binary, but unlike "fully static" the binary is
> not runnable without ld.so and a fitting libc.

Yeah, I am aware and was glossing over the details slightly but thanks
for clarifying.

You can force static when linking specific libraries with -Wl,-static
and then undo this with -Wl,-dynamic. I don't know whether it's
feasible to do this with flags passed to Portage though, haven't tried.
Another approach might be to use INSTALL_MASK to filter out the share
libraries you don't want but that may have issues too.

> > That probably explains why the ceph dependencies are as they are  
> 
> I think USE=static-libs is nice to have, and ideally (IMHO) it would
> be a global USE flag, respected by every package that installs a
> library. The flag says nothing about consumers, it only promises
> availability of the .a files, which I think is nice.

Agreed, I think this is a reasonable position to take.

-- 
James Le Cuirot (chewi)
Gentoo Linux Developer

Attachment: pgpvl5NR5ynXt.pgp
Description: OpenPGP digital signature

Reply via email to