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
Hello, folks.

As some of you are already aware, the C++11 standard brought a few
changes to the C++ standard library. As a result, the standard library
used in C++11 mode has a different ABI than the one used in pre-C++11
mode. And this means that libraries that use some of standard C++ types
in their APIs also have different ABIs depending on the C++ standard
used to build them. This is somehow explained in [1].

As a result, if a single library suffers that, its reverse dependencies
need to be built with the same C++ standard. And then, those can force
even more dependencies and you may guess where this is going.

Basically, I've hit this with sys-devel/llvm. A user has requested lldb
support to be enabled in the ebuild [2]. Sadly, lldb requires C++11 to
be used, and this means that whole LLVM needs to become C++11 enabled.
And then, it would be at least recommended that all reverse deps become
C++11 enabled as well.


This raises the following question: how do we want to do it? I see two

a) adding USE=c++11 and USE-deps to all the packages in question,

b) doing the switch via synchronous version bump and matching

I think that the variant a) is simpler. It goes like this:

1) we add 'sys-devel/llvm[-c++11(-)]' deps to everything that uses it,

2) we add USE=c++11 to llvm,

3) we add USE=c++11 and 'sys-devel/llvm[c++11=(-)]' deps to newest
version of everything that uses it.

The advantage is that plain users may just keep USE=c++11 disabled as
it is by default, and avoid hitting some issues with non-tree packages
and so on.

At some point, we'll probably want to remove non-C++11 support
completely. Then we could start by use.forcing the flag, changing deps
in packages and so on.

The variant b) requires much more synchronous work. In this case, we:

1) update LLVM deps to '<=' deps in everything that uses it,

2) revbump llvm and unconditionally enable C++11 in it,

3) update the reverse deps to enable C++11 and use '>=' deps on the new

Of course, the same steps need to be repeated for every C++ reverse dep
of reverse deps, and libs and so on. In other words, it's a lot of work.

The problem with this solution is that as soon as user upgrades, shklee
is forced to use C++11. On the other hand, we get rid of pre-C++11
packages quite transparently, without extra work.

What are your thoughts?

Best regards,
Michał Górny


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


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>