Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev <gentoo-dev@l.g.o>
Subject: [gentoo-dev] Proliferation of IUSE=static-libs in Gentoo
Date: Thu, 08 Mar 2018 15:40:57
Message-Id: 1520523644.13614.14.camel@gentoo.org
1 Hello, developers.
2
3 I would like to bring to your attention an alarming trend in Gentoo
4 ebuilds -- the proliferation of IUSE=static-libs, that is a flag
5 allowing our users to build static libraries.
6
7 I should like to remind you that static linking is almost always a bad
8 idea. It has serious security implications, it is poorly supported on
9 *nix systems (example: library dependencies are provided via hacks, we
10 don't have proper rebuild capabilities) and should be basically
11 considered a great evil. Partially relevant doc: [1].
12
13 This is why Gentoo does not generally support statically linking stuff,
14 and we force dynamic linking whenever possible (sometimes even going too
15 far with that but that's another story). We only allow static linking
16 for special cases where shared linking can't be used for one reason
17 or another.
18
19 As part of that we also shouldn't deliver static libraries unless
20 absolutely necessary to satisfy the dependencies of applications which
21 we support built statically. Back in the day, Gentoo developers were
22 pushing against packages that built static libraries unconditionally.
23 However, it seems that at some point this front changed from 'fighting
24 unconditionally built static libraries' to 'proliferating USE=static-
25 libs everywhere'. Which is bad.
26
27 So, developers, please *stop adding USE=static-libs* to random libraries
28 that have no reason whatever to be statically linked to. And by that I
29 mean a good reason, not creeping featurism, not 'user asked for it', not
30 'this broken package hardcodes libfoo.a'.
31
32 If upstream doesn't build static libraries by default, don't add flags
33 to make it do it. If upstream builds static libraries by default, just
34 pass '--disable-static' instead of adding a flag for it. If upstream
35 uses CMake and supports building only one type of libraries, there's no
36 need to write patches to make it behave like automake/libtool.
37
38 Also, if your package has unnecessary IUSE=static-libs that is not
39 correctly needed by any other package, please drop it.
40
41 Please remember that not installing static libraries is the first step
42 towards preventing broken build systems from unnecessary linking to them
43 (think of upstreams who pass -Wl,-Bstatic unconditionally).
44
45 Thanks.
46
47 [1]:https://wiki.gentoo.org/wiki/Why_not_bundle_dependencies
48
49 --
50 Best regards,
51 Michał Górny

Replies