Solved Is _GLIBCXX_USE_CXX11_ABI=0 defined in pre-build versions of Qt?
-
Gcc ABI was significantly changed between 4.x and 5.x. If you try to link application with third-party library that was compiled with an older version of GCC then you get linker errors about undefined references to symbols that involve types in the std::__cxx11 namespace. The problem is related to https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
But the same Qt binary distribution for Linux links correctly for gcc 5.x and gcc 4.x.
What was done to get this result? How the problem of different gcc ABI is resolved? Is _GLIBCXX_USE_CXX11_ABI=0 defined for Qt pre-build version that is available to download?
-
Please ask on Interest mailing list, many developers who write Qt are present there.
-
@sierdzio said in Is _GLIBCXX_USE_CXX11_ABI=0 defined in pre-build versions of Qt?:
Please ask on Interest mailing list, many developers who write Qt are present there.
I have got answer from Interest mailing list.
Summary:Q: Why the same Qt binaries may be used with different compilers (gcc 4.x, gcc 5.x) and other libraries cannot be used?
A: GCC ABI was changed for standard library (https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html ). Qt does not depend on standard library. If other library depends on standard library then it will link with errors. Inline methods (like QString::toStdString, QVector::toStdVector, etc...) are fine because they are compiled with the same C++ ABI as used in the applicationQ: Is it possible for GCC 5.x to link with the library compiled by GCC 4.x?
A: Yes. The old GCC ABI is still supported and can be used by defining the macro _GLIBCXX_USE_CXX11_ABI to 0 before including any C++ standard library headers (https://gcc.gnu.org/gcc-5/changes.html#libstdcxx ). -
@blex said in Is _GLIBCXX_USE_CXX11_ABI=0 defined in pre-build versions of Qt?:
I have got answer from Interest mailing list.
Thank you for sharing it here as well!
-
@blex thanks!