Gentoo Archives: gentoo-dev

From: Alec Warner <antarus@g.o>
To: Gentoo Dev <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] Proliferation of IUSE=static-libs in Gentoo
Date: Thu, 08 Mar 2018 15:59:42
Message-Id: CAAr7Pr-=BtQOUbu_8_87LvL1eubTxpob7Dw6EQXVr99zzUpBNA@mail.gmail.com
In Reply to: [gentoo-dev] Proliferation of IUSE=static-libs in Gentoo by "Michał Górny"
1 On Thu, Mar 8, 2018 at 10:40 AM, Michał Górny <mgorny@g.o> wrote:
2
3 > Hello, developers.
4 >
5 > I would like to bring to your attention an alarming trend in Gentoo
6 > ebuilds -- the proliferation of IUSE=static-libs, that is a flag
7 > allowing our users to build static libraries.
8 >
9 > I should like to remind you that static linking is almost always a bad
10 > idea. It has serious security implications, it is poorly supported on
11 > *nix systems (example: library dependencies are provided via hacks, we
12 > don't have proper rebuild capabilities) and should be basically
13 > considered a great evil. Partially relevant doc: [1].
14 >
15 > This is why Gentoo does not generally support statically linking stuff,
16 > and we force dynamic linking whenever possible (sometimes even going too
17 > far with that but that's another story). We only allow static linking
18 > for special cases where shared linking can't be used for one reason
19 > or another.
20 >
21
22 > As part of that we also shouldn't deliver static libraries unless
23 > absolutely necessary to satisfy the dependencies of applications which
24 > we support built statically. Back in the day, Gentoo developers were
25 > pushing against packages that built static libraries unconditionally.
26 > However, it seems that at some point this front changed from 'fighting
27 > unconditionally built static libraries' to 'proliferating USE=static-
28 > libs everywhere'. Which is bad.
29 >
30 >
31 So to me this is a murky metadistribution / distribution problem.
32
33 Like if upstream ships "--enable-static-libs" we should probably support a
34 USE flag to enable it; this is the metadistribution use case.[1]
35
36 For people actually running Gentoo, Gentoo strongly advises not building
37 static libs (and we can disable the static-libs USE flag in a profile or
38 otherwise
39 encourage users not to use it because of all the reasons stated.)
40
41 So, developers, please *stop adding USE=static-libs* to random libraries
42 > that have no reason whatever to be statically linked to. And by that I
43 > mean a good reason, not creeping featurism, not 'user asked for it', not
44 > 'this broken package hardcodes libfoo.a'.
45 >
46 > If upstream doesn't build static libraries by default, don't add flags
47 > to make it do it. If upstream builds static libraries by default, just
48 > pass '--disable-static' instead of adding a flag for it. If upstream
49 > uses CMake and supports building only one type of libraries, there's no
50 > need to write patches to make it behave like automake/libtool.
51 >
52 > Also, if your package has unnecessary IUSE=static-libs that is not
53 > correctly needed by any other package, please drop it.
54 >
55 > Please remember that not installing static libraries is the first step
56 > towards preventing broken build systems from unnecessary linking to them
57 > (think of upstreams who pass -Wl,-Bstatic unconditionally).
58 >
59
60 [1] I am somewhat empathetic to the argument that when we support something
61 in the metadistribution but no distributions are using it; it can become
62 stale / broken / untested
63 and I'd consider not adding the flags on those grounds though.
64
65
66 >
67 > Thanks.
68 >
69 > [1]:https://wiki.gentoo.org/wiki/Why_not_bundle_dependencies
70 >
71 > --
72 > Best regards,
73 > Michał Górny
74 >
75 >
76 >