As a downstream maintainer in a Linux distribution, some of the packages that I usually maintain are starting to use the C++11 features in their code base. All of them depend on different libraries packaged by the Linux distributions.
作为Linux发行版中的下游维护者,我通常维护的一些软件包开始在其代码库中使用C ++ 11特性。所有这些都依赖于Linux发行版打包的不同库。
Problems with the ABI could appear when mixing C++11 code with C++98 and AFAIK, most of the current major Linux Distributions are not enabling the C++11 flag by default when compiling software to generate packages.
将C ++ 11代码与C ++ 98和AFAIK混合时,可能会出现ABI问题,当编译软件生成包时,大多数当前主要的Linux发行版都默认不启用C ++ 11标志。
The question is: How are the major Linux distributions handling the entry of C++11 code? Is there a decent way of checking or avoiding these problems with the ABI when using system libraries?
问题是:主要的Linux发行版如何处理C ++ 11代码的输入?在使用系统库时,是否有一种可靠的方法来检查或避免ABI的这些问题?
Thanks.
1 个解决方案
#1
3
The issue has nothing to do with C++11 vs C++98 except that C++11 can motivate binary changes. There is nothing special about binary changes motivated by C++11. They are just as breaking or non-breaking as regular binary changes. Furthermore, they are only changed if the library maintainer specifically chooses to change his binary interface.
这个问题与C ++ 11和C ++ 98无关,只是C ++ 11可以激发二进制更改。由C ++ 11推动的二进制更改没有什么特别之处。它们与常规二进制更改一样破碎或不破坏。此外,只有在库维护者专门选择更改其二进制接口时才会更改它们。
In other words, this has nothing to do with the Standard version and everything to do with the library, unless the library explicitly chooses to offer two different binary interfaces to different Standard versions (which is still a library choice). Excepting this case, you are just as broken in C++98 as you are in C++11. Itanium is backwards compatible between the C++11-supporting versions and the C++98-supporting versions, so the compiler ABIs are not broken.
换句话说,这与标准版本以及与库有关的一切都没有关系,除非库明确选择为不同的标准版本提供两个不同的二进制接口(它仍然是库选择)。除了这种情况,你在C ++ 98中就像在C ++ 11中一样。 Itanium在支持C ++ 11的版本和支持C ++ 98的版本之间向后兼容,因此编译器ABI不会被破坏。
From memory, unless you're using 4.7.0 which they broke for fun and then unbroke, you're pretty much safe with libstdc++- they are storing up ABI breakage for a future release when they can make one big break.
从内存开始,除非你使用的是4.7.0,他们为了好玩而破坏了它们,你使用libstdc ++非常安全 - 他们正在为将来的版本存储ABI破坏,因为它们可以有一个很大的突破。
In other words, whilst the transition period to C++11 can introduce additional motivation to break ABI and therefore additional risk, actually using C++11 itself does not introduce any additional risk.
换句话说,虽然到C ++ 11的过渡期可以引入额外的动机来打破ABI并因此带来额外的风险,但实际上使用C ++ 11本身并不会带来任何额外的风险。
#1
3
The issue has nothing to do with C++11 vs C++98 except that C++11 can motivate binary changes. There is nothing special about binary changes motivated by C++11. They are just as breaking or non-breaking as regular binary changes. Furthermore, they are only changed if the library maintainer specifically chooses to change his binary interface.
这个问题与C ++ 11和C ++ 98无关,只是C ++ 11可以激发二进制更改。由C ++ 11推动的二进制更改没有什么特别之处。它们与常规二进制更改一样破碎或不破坏。此外,只有在库维护者专门选择更改其二进制接口时才会更改它们。
In other words, this has nothing to do with the Standard version and everything to do with the library, unless the library explicitly chooses to offer two different binary interfaces to different Standard versions (which is still a library choice). Excepting this case, you are just as broken in C++98 as you are in C++11. Itanium is backwards compatible between the C++11-supporting versions and the C++98-supporting versions, so the compiler ABIs are not broken.
换句话说,这与标准版本以及与库有关的一切都没有关系,除非库明确选择为不同的标准版本提供两个不同的二进制接口(它仍然是库选择)。除了这种情况,你在C ++ 98中就像在C ++ 11中一样。 Itanium在支持C ++ 11的版本和支持C ++ 98的版本之间向后兼容,因此编译器ABI不会被破坏。
From memory, unless you're using 4.7.0 which they broke for fun and then unbroke, you're pretty much safe with libstdc++- they are storing up ABI breakage for a future release when they can make one big break.
从内存开始,除非你使用的是4.7.0,他们为了好玩而破坏了它们,你使用libstdc ++非常安全 - 他们正在为将来的版本存储ABI破坏,因为它们可以有一个很大的突破。
In other words, whilst the transition period to C++11 can introduce additional motivation to break ABI and therefore additional risk, actually using C++11 itself does not introduce any additional risk.
换句话说,虽然到C ++ 11的过渡期可以引入额外的动机来打破ABI并因此带来额外的风险,但实际上使用C ++ 11本身并不会带来任何额外的风险。