(如何)我可以在Centos / RHEL上将新的C ++ 11 ABI与devtoolset-7一起使用吗? [英] (How) Can I use the new C++ 11 ABI with devtoolset-7 on Centos/RHEL?
问题描述
我的目标是在Centos 7上使用gcc 7.2(和clang 6)来构建与Centos 7目标兼容的可执行文件,而无需安装devtoolset,而是*使用较新的C ++ ABI *。
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 *.
较新的ABI修复了lib中的一些缺陷,这些缺陷如果不更改ABI便无法修复。例如:list :: size O(1)Vs O(n),字符串不带COW。
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.
我推测一个答案,为什么在接下来的问题。
-D_GLIBCXX_USE_CXX11_ABI = 1对CentOS 7上的devtoolset-7无效
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
推荐答案
这似乎与您链接的问题重复,我看不出有什么理由可以同时打开它们。
This seems like a duplicate of the question you linked to, I don't see any reason to keep both open.
我可以在Centos /上使用带devtoolset-7的新C ++ 11 ABI吗? RHEL吗?
Can I use the new C++ 11 ABI with devtoolset-7 on Centos/RHEL?
否。 cxx11
ABI影响 libstdc ++。so
(特别是语言环境方面)内部的许多因素,这些因素无法得到支持devtoolset混合链接模型。初始化语言环境的相关函数已经存在于系统 libstdc ++。so
中,不能由devtoolset的 libstdc ++ _ nonshared.a <代替。 / code>。因此(为了避免我们不想影响RHEL / CentOS用户的其他潜在的ABI不匹配),我们在devtoolset中禁用了新的ABI(如另一个问题的答案)。
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).
如果您确实需要新的 cxx11
ABI,您需要构建自己的GCC 7,它使用正常的动态链接到其自己的 libstdc ++。so
(而不是devtoolset使用的混合链接模型),并且然后确保在运行时使用新的libstdc ++。so(请参见在手册中查找动态库或共享库。
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).
这篇关于(如何)我可以在Centos / RHEL上将新的C ++ 11 ABI与devtoolset-7一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!