Gentoo Archives: gentoo-dev

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] impending c++11 clusterfuck?
Date: Mon, 30 Nov 2015 11:17:48
Message-Id: 565C304C.8060202@gentoo.org
In Reply to: Re: [gentoo-dev] impending c++11 clusterfuck? by "Michał Górny"
1 On 11/30/15 4:52 AM, Michał Górny wrote:
2 >
3 > Dnia 30 listopada 2015 09:07:30 CET, "Anthony G. Basile" <blueness@g.o> napisał(a):
4 >> On 11/30/15 1:42 AM, Michał Górny wrote:
5 >>> On Sun, 29 Nov 2015 19:56:04 -0800
6 >>> "Gregory M. Turner" <gmt@×××××××.net> wrote:
7 >>>
8 >>>> I'm quoting myself from bug #566328 here. These were off-the-cuff
9 >>>> remarks that got away from me and became a call-to-arms...
10 >>>>
11 >>>> (In reply to Michał Górny from comment #7)
12 >>>>> This is never this simple. C++11 can change the ABI. So the point
13 >> kinda is,
14 >>>>> we need to ensure that all C++ libraries in a depgraph use the same
15 >> C++
16 >>>>> version.
17 >>>> This is pretty awful when you really think about it. I feel like
18 >> I'm
19 >>>> watching a train-wreck in super slow motion.
20 >>> Well, it's not that bad actually. After some thinking, I figured out
21 >>> they fixed most 98/11 incompatibilities around gcc 4.8/4.9, and left
22 >>> only a few 'unlikely' to cause issues.
23 >>>
24 >>> However, if one dep switches to C++11, it is quite likely to require
25 >>> C++11 in its revdeps, and that's what happening with libsigc++
26 >>> and other gtkmm libraries.
27 >> When building a package, you can't just switch between -std=gnu++98 or
28 >> c++99 or gnu++11 or c++11 since there are syntactic difference.
29 >>> Plus, there's of course the classical issue of ABI incompatibility
30 >>> between libstdc++ bundled with 4.9 and 5.1, and 5.2... so along with
31 >>> switching g++ version, you soon start to have to rebuild random C++
32 >>> libraries.
33 >>>
34 >>> And the issue of supporting alternative C++ standard library
35 >>> implementations -- like using libcxx with clang. They are of course
36 >>> incompatible with GNU's ever-changing ABI.
37 >>>
38 >>>> I'm not sure we're taking this seriously enough -- sooner or later
39 >> it
40 >>>> seems destined to become a major clusterfuck if we don't do
41 >> something
42 >>>> proactive about it now while the drawing-board is relatively
43 >>>> uncluttered.
44 >>>>
45 >>>> The only thing I can think of that has this kind of two-way depgraph
46 >>>> magic property are the major "abi" USE_EXPAND values (multilib-build
47 >>>> and python-r1, in other words).
48 >>>>
49 >>>> But those rely on fancy framework-generated USE-flag deps, which
50 >> seem
51 >>>> like overkill and likely to incur unjustifiable
52 >> user-experience-costs.
53 >>> Yes, it is terrible. You end up introducing a lot of USE flags that
54 >>> need to be manually switched along with gcc versions. If we start
55 >>> splitting them between c++98 and c++11, we're quite likely to hit USE
56 >>> flag conflicts between packages/developers which prefer one over
57 >>> another.
58 >> This would be a nightmare.
59 >>
60 >>>> Perhaps a solution to this cxx11 clusterfuck can be found that works
61 >>>> more like perl? By that I mean, pick your poison (respectively,
62 >> your
63 >>>> cxx11 ABI of preference or your major perl version of choice), rely
64 >> on
65 >>>> inbuilt portage features do the trick most of the time, and, when it
66 >>>> breaks, run "magically-fix-everything.sh," grab a caffeinated
67 >> beverage
68 >>>> or three and fire up your favorite VOD client while the mess gets
69 >>>> magically cleaned up by robots somehow.
70 >>> Sadly := can't help here since gcc switches occur independently of
71 >>> package installs. And AFAIK revdep-rebuild doesn't help either.
72 >> You can run `revdep-rebuild -L 'libstdc\+\+\.so\.6'` to rebuild
73 >> everything that links against libstdc++.so.6. This will rebuild a lot
74 >> of packages but will fix everything.
75 >>
76 >> If we record enough information at build time (eg. gcc version or
77 >> libcxx/clang) then we can build tools that intelligently predict if
78 >> there's an abi incompatibility. Unfortunately gcc doesn't bump soname
79 >> and/or version-info when it changes c++11 abi. (since c++11 is
80 >> experimental and c++03/98 have stable abi, they don't want to force
81 >> rebuilds). So we have to record the equivalent of an soname. If we
82 >> put
83 >> that information in a file like NEEDED.ELF.2 in vdb, it could be read
84 >> by
85 >> utilities like magically-fix-everything.sh (a revddep-rebuild.sh for
86 >> libstdc++).
87 > In my case, checking CXX + library symbols (to distinguish C++ libraries) works. But most of the people believe setting CXX to a static version is a bad idea, and it's better to use implicit magic of gcc-config.
88 >
89
90 different direction: what about building with
91 rpath=/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/ and then making sure that
92 portage respects that library file during any --depclean or
93 @preserved-rebuild? i'm not sure how we'd
94 inject|||LDFLAGS=-Wl,-rpath=... consistantly and sanely into all c++ builds.
95
96 this would solve all problems i can see: 1) gcc-config reshuffles
97 /etc/ld.so.conf.d/05gcc-<tuple>.conf but rpath takes presidence, 2) the
98 correct library symbols are guaranteed to be there in both exe and lib.
99 3) it pro-actively guards against abi mismatches when switching gcc even
100 for other languages like fortran, java, obj-c.|
101
102 --
103 Anthony G. Basile, Ph.D.
104 Gentoo Linux Developer [Hardened]
105 E-Mail : blueness@g.o
106 GnuPG FP : 1FED FAD9 D82C 52A5 3BAB DC79 9384 FA6E F52D 4BBA
107 GnuPG ID : F52D4BBA

Replies

Subject Author
Re: [gentoo-dev] impending c++11 clusterfuck? "Anthony G. Basile" <blueness@g.o>
Re: [gentoo-dev] impending c++11 clusterfuck? Benda Xu <heroxbd@g.o>
Re: [gentoo-dev] impending c++11 clusterfuck? "Michał Górny" <mgorny@g.o>