1 |
On Sun, 5 Apr 2020 17:20:07 +0000 |
2 |
Peter Stuge <peter@×××××.se> wrote: |
3 |
|
4 |
> James Le Cuirot wrote: |
5 |
> > Damn, I realised just as I hit send that there's a caveat here and |
6 |
> > that's sub-dependencies. If you're building a partially static binary |
7 |
> > then I think you're okay. A fully static binary obviously needs all its |
8 |
> > dependencies to be static and that includes any sub-dependencies. |
9 |
> |
10 |
> Note that there isn't really a way to express "partially static" to the |
11 |
> toolchain when building a binary. |
12 |
> |
13 |
> If you link a binary -static then that is always "fully static". No .so |
14 |
> will satisfy any -l options. |
15 |
> |
16 |
> The only way a "partially static" binary gets created is when linking |
17 |
> *without* -static but some -l libraries only exist as static libraries, |
18 |
> or if a library/object archive is specified with full .a filename, |
19 |
> without using -l. |
20 |
> |
21 |
> And "partially static" also only means that some dependencies were |
22 |
> included into the binary, but unlike "fully static" the binary is |
23 |
> not runnable without ld.so and a fitting libc. |
24 |
|
25 |
Yeah, I am aware and was glossing over the details slightly but thanks |
26 |
for clarifying. |
27 |
|
28 |
You can force static when linking specific libraries with -Wl,-static |
29 |
and then undo this with -Wl,-dynamic. I don't know whether it's |
30 |
feasible to do this with flags passed to Portage though, haven't tried. |
31 |
Another approach might be to use INSTALL_MASK to filter out the share |
32 |
libraries you don't want but that may have issues too. |
33 |
|
34 |
> > That probably explains why the ceph dependencies are as they are |
35 |
> |
36 |
> I think USE=static-libs is nice to have, and ideally (IMHO) it would |
37 |
> be a global USE flag, respected by every package that installs a |
38 |
> library. The flag says nothing about consumers, it only promises |
39 |
> availability of the .a files, which I think is nice. |
40 |
|
41 |
Agreed, I think this is a reasonable position to take. |
42 |
|
43 |
-- |
44 |
James Le Cuirot (chewi) |
45 |
Gentoo Linux Developer |