GCC 4.7, STL and binary compatibility of objects built with different language standards
didrocks at ubuntu.com
Tue Jun 12 16:47:06 UTC 2012
Le 12/06/2012 18:22, Matthias Klose a écrit :
> On 08.06.2012 17:10, Chris Coulson wrote:
>> I've just finished debugging a Unity crash which occurs when we try a
>> test rebuild of Unity and Nux with GCC4.7 in quantal. Although the
>> original issue was caused by mixing 2 C++ ABI's (because libsigc hasn't
>> been rebuilt yet in quantal), it was no better even after rebuilding
>> libsigc with the quantal toolchain.
> correct, afaics there is no ABI incompatibility between 4.6 and 4.7, but between
> c++98 and c++0x/c++11.
> c++98 and c++0x/c++11 code should not be mixed in one binary, and best avoided
> in a distribution.
>> What is happening is, in GCC4.7, std::_List_base::_List_impl has a data
>> member which only exists for compilation units that are built with
>> -std=c++0x (_M_size). This means that the STL ABI is dependent on the
>> language standard. This obviously causes issues when a process loads
>> libraries that are built with different language standards and which
>> pass std::list's across public API's
> indeed, this is the one issue, which is new in 4.7, so you didn't see it in
> precise with 4.6.
>> In the Unity case, both Unity and Nux are built with -std=c++0x, but
>> they use libsigc which is not built with it and which exposes STL
>> objects in its public API. Rebuilding libsigc locally with -std=c++0x is
>> sufficient to make Unity work properly. However, uploading this will
>> probably break anything else in the archive using libsigc which isn't
>> built with -std=c++0x, so I'm not sure of the best way to proceed.
> both -std=c++0x and -std=c++11 are still marked as experimental. So don't use
> them :-/ I don't think that building c++ libraries for both modes is the right
> approach, so let's avoid that for now, until the c++11 support in 4.7 is more
> complete, and maybe not experimental.
Yes, indeed, the situation is suboptimal. as this feature is marked as
experimental. However, I'm afraid that we have an issue about this.
Indeed, Unity is written using a lot of c++11 facilities, and taking it
out won't be trivial now AFAIK. I'm CCing Tim who can give more
information about it.
I thought that you agreed on IRC yesterday to have a look this week how
to build those libraries for both modes, has anything changed to that?
More information about the ubuntu-devel