Gentoo Archives: gentoo-dev

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

Replies

Subject Author
Re: [gentoo-dev] impending c++11 clusterfuck? "Anthony G. Basile" <blueness@g.o>