Gentoo Archives: gentoo-dev

From: Guilherme Amadio <amadio@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [RFC] C++ standard in ebuilds
Date: Mon, 17 Sep 2018 15:37:51
Message-Id: 20180917153738.GA5402@gentoo.org
1 Hi everyone,
2
3 I would like to discuss a system-wide way to handle C++ standard setting
4 in Gentoo. We currently have many packages appending -std=c++XX to their
5 flags, and it's hard to keep track of which packages use which version
6 of the standard. This is a problem when packages force dependencies to
7 use the same version of the standard, or if certain combinations cause
8 ABI or other breakage (i.e., due to backports conflicting with standard
9 classes). We currently have the page below with some documentation, but
10 I have not found much else on the topic:
11 https://wiki.gentoo.org/wiki/Project:C%2B%2B/Maintaining_ABI
12
13 One problem is that depending on the compiler version, the right option
14 may change (e.g. -std=c++1y vs -std=c++14 and -std=c++1z vs -std=c++17).
15 This isn't a big problem when using recent compilers, but may be it will
16 if you want to test some package you develop with an older compiler you
17 still need to support (out of Gentoo), or if you use ICC, which lags a
18 bit behind in standards support. For CMake projects, we could set
19 CMAKE_CXX_STANDARD in cmake-utils.eclass. For other projects we could
20 use other means. In any case, it might make sense to have global USE
21 flags like c++11 (already a local USE flag), c++14, etc, along with a
22 small eclass that C++ projects can inherit to get the right setting
23 instead of using append-cxxflags with a hard-coded standard version.
24 Hard-coding the standard flag may create problems because we will have a
25 mix of the default and the hard-coded ones. The USE flags would also
26 allow depending on a package with the same standard configuration or
27 setting the standard globally to something different than the compiler
28 default (i.e. either stay with C++11 because that's what you need to
29 work with, or use C++17 since you are on ~arch and your system compiler
30 supports it, etc).
31
32 What are your thoughts on the matter? This has been discussed in the
33 past¹, but it doesn't seem we have a global solution yet. I think
34 another discussion happened more recently, but I didn't find the thread.
35
36 Cheers,
37 —Guilherme
38
39 1. https://archives.gentoo.org/gentoo-dev/message/eab0dc92cb8adb1457ff368c5a033eaf

Replies

Subject Author
Re: [gentoo-dev] [RFC] C++ standard in ebuilds "Vadim A. Misbakh-Soloviov" <gentoo@×××.name>
Re: [gentoo-dev] [RFC] C++ standard in ebuilds Matt Turner <mattst88@g.o>