Gentoo Archives: gentoo-dev

From: Ian Stakenvicius <axs@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] How to support C++11 in libraries?
Date: Wed, 18 Dec 2013 14:28:06
Message-Id: 52B1B0EB.5060402@gentoo.org
In Reply to: [gentoo-dev] How to support C++11 in libraries? by "Michał Górny"
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA256
3
4 On 18/12/13 02:54 AM, Michał Górny wrote:
5 > Hello, folks.
6 >
7 > As some of you are already aware, the C++11 standard brought a few
8 > changes to the C++ standard library. As a result, the standard
9 > library used in C++11 mode has a different ABI than the one used
10 > in pre-C++11 mode. And this means that libraries that use some of
11 > standard C++ types in their APIs also have different ABIs
12 > depending on the C++ standard used to build them. This is somehow
13 > explained in [1].
14 >
15 > As a result, if a single library suffers that, its reverse
16 > dependencies need to be built with the same C++ standard. And
17 > then, those can force even more dependencies and you may guess
18 > where this is going.
19 >
20 > Basically, I've hit this with sys-devel/llvm. A user has requested
21 > lldb support to be enabled in the ebuild [2]. Sadly, lldb requires
22 > C++11 to be used, and this means that whole LLVM needs to become
23 > C++11 enabled. And then, it would be at least recommended that all
24 > reverse deps become C++11 enabled as well.
25 >
26 > [1]:http://gcc.gnu.org/wiki/Cxx11AbiCompatibility
27 > [2]:https://bugs.gentoo.org/show_bug.cgi?id=464354
28 >
29 >
30 > This raises the following question: how do we want to do it? I see
31 > two possibilities:
32 >
33 > a) adding USE=c++11 and USE-deps to all the packages in question,
34 >
35 > b) doing the switch via synchronous version bump and matching
36 > dependencies.
37 >
38 >
39 > I think that the variant a) is simpler. It goes like this:
40 >
41 > 1) we add 'sys-devel/llvm[-c++11(-)]' deps to everything that uses
42 > it,
43 >
44 > 2) we add USE=c++11 to llvm,
45 >
46 > 3) we add USE=c++11 and 'sys-devel/llvm[c++11=(-)]' deps to newest
47 > version of everything that uses it.
48 >
49 > The advantage is that plain users may just keep USE=c++11 disabled
50 > as it is by default, and avoid hitting some issues with non-tree
51 > packages and so on.
52 >
53 > At some point, we'll probably want to remove non-C++11 support
54 > completely. Then we could start by use.forcing the flag, changing
55 > deps in packages and so on.
56 >
57 >
58
59
60 I think variant A is probably a better solution all around, not least
61 because this type of choice is almost a profile-level decision and a
62 global USE flag setting seems an appropriate way to ensure it works.
63 Plus, the use flag method allows those that want to fiddle with it
64 per-package to be able to do so while still guaranteeing the deptree
65 is properly synchronized as per the version.
66
67 variant B does offer the nice ability to just force it and therefore
68 not give end-users this new flag to worry about, but I forsee that we
69 will have conflicts with upgrading/downgrading package between the
70 pre- and post-C++11 border. If we were a versioned distro this would
71 be the way to go, but....
72
73
74
75 -----BEGIN PGP SIGNATURE-----
76 Version: GnuPG v2.0.22 (GNU/Linux)
77
78 iF0EAREIAAYFAlKxsOsACgkQ2ugaI38ACPAW7wD49p8JqopRARN4h6lB8+Z5bXs2
79 VB8Gb0wPMJouAuwpaAD8CDAa4L7w9KP9QXXaSnJrojdBmk9bZQ0GDJL26/5sqf4=
80 =01b1
81 -----END PGP SIGNATURE-----