Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] How to support C++11 in libraries?
Date: Wed, 18 Dec 2013 07:55:10
Message-Id: 20131218085447.56d1e133@gentoo.org
1 Hello, folks.
2
3 As some of you are already aware, the C++11 standard brought a few
4 changes to the C++ standard library. As a result, the standard library
5 used in C++11 mode has a different ABI than the one used in pre-C++11
6 mode. And this means that libraries that use some of standard C++ types
7 in their APIs also have different ABIs depending on the C++ standard
8 used to build them. This is somehow explained in [1].
9
10 As a result, if a single library suffers that, its reverse dependencies
11 need to be built with the same C++ standard. And then, those can force
12 even more dependencies and you may guess where this is going.
13
14 Basically, I've hit this with sys-devel/llvm. A user has requested lldb
15 support to be enabled in the ebuild [2]. Sadly, lldb requires C++11 to
16 be used, and this means that whole LLVM needs to become C++11 enabled.
17 And then, it would be at least recommended that all reverse deps become
18 C++11 enabled as well.
19
20 [1]:http://gcc.gnu.org/wiki/Cxx11AbiCompatibility
21 [2]:https://bugs.gentoo.org/show_bug.cgi?id=464354
22
23
24 This raises the following question: how do we want to do it? I see two
25 possibilities:
26
27 a) adding USE=c++11 and USE-deps to all the packages in question,
28
29 b) doing the switch via synchronous version bump and matching
30 dependencies.
31
32
33 I think that the variant a) is simpler. It goes like this:
34
35 1) we add 'sys-devel/llvm[-c++11(-)]' deps to everything that uses it,
36
37 2) we add USE=c++11 to llvm,
38
39 3) we add USE=c++11 and 'sys-devel/llvm[c++11=(-)]' deps to newest
40 version of everything that uses it.
41
42 The advantage is that plain users may just keep USE=c++11 disabled as
43 it is by default, and avoid hitting some issues with non-tree packages
44 and so on.
45
46 At some point, we'll probably want to remove non-C++11 support
47 completely. Then we could start by use.forcing the flag, changing deps
48 in packages and so on.
49
50
51 The variant b) requires much more synchronous work. In this case, we:
52
53 1) update LLVM deps to '<=' deps in everything that uses it,
54
55 2) revbump llvm and unconditionally enable C++11 in it,
56
57 3) update the reverse deps to enable C++11 and use '>=' deps on the new
58 version.
59
60 Of course, the same steps need to be repeated for every C++ reverse dep
61 of reverse deps, and libs and so on. In other words, it's a lot of work.
62
63 The problem with this solution is that as soon as user upgrades, shklee
64 is forced to use C++11. On the other hand, we get rid of pre-C++11
65 packages quite transparently, without extra work.
66
67
68 What are your thoughts?
69
70 --
71 Best regards,
72 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] How to support C++11 in libraries? "C. Bergström" <cbergstrom@×××××××××.com>
Re: [gentoo-dev] How to support C++11 in libraries? heroxbd@g.o
Re: [gentoo-dev] How to support C++11 in libraries? Ian Stakenvicius <axs@g.o>
Re: [gentoo-dev] How to support C++11 in libraries? "Anthony G. Basile" <blueness@g.o>
Re: [gentoo-dev] How to support C++11 in libraries? Sven Eden <sven.eden@×××.de>