Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
395 views
in Technique[技术] by (71.8m points)

c++11 - (How) Can I use the new C++ 11 ABI with devtoolset-7 on Centos/RHEL?

My goal is to use gcc 7.2 (and clang 6) on Centos 7 to build executables compatible with Centos 7 targets without devtoolset installed but * using the newer C++ ABI *.

The newer ABI fixed a couple of deficiencies in the lib that weren't able to be fixed without an ABI change. E.g list::size O(1) Vs O(n), no COW for strings.

I speculated on an answer as to why this might not be possible in the following question. -D_GLIBCXX_USE_CXX11_ABI=1 ineffective for devtoolset-7 on CentOS 7

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This seems like a duplicate of the question you linked to, I don't see any reason to keep both open.

Can I use the new C++ 11 ABI with devtoolset-7 on Centos/RHEL?

No. The cxx11 ABI affects a number of things internal to libstdc++.so (specifically, locale facets) which cannot be supported by the devtoolset mixed linkage model. The relevant functions that initialize locales are already present in the system libstdc++.so and can't be replaced by the devtoolset's libstdc++_nonshared.a. Because of that (and to avoid other potential ABI mismatches that we don't want to affect RHEL/CentOS users) we disable the new ABI in devtoolset (as correctly stated in the answer to the other question).

If you really need the new cxx11 ABI you'll need to build your own GCC 7 that uses normal dynamic linking to its own libstdc++.so (rather than the mixed linkage model used by devtoolset) and then ensure that new libstdc++.so gets used at runtime (see Finding Dynamic or Shared Libraries in the manual).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...