How to manage the GCC >= 5 ABI

In version 5.1, GCC released libstdc++, which introduced a new library ABI that includes new implementations of std::string and std::list. These changes were necessary to conform to the 2011 C++ standard which forbids Copy-On-Write strings and requires lists to keep track of their size.

You can choose which ABI to use in your Conan packages by adjusting the compiler.libcxx:

  • libstdc++: Old ABI.

  • libstdc++11: New ABI.

When Conan creates the default profile the first time it runs, it adjusts the compiler.libcxx setting to libstdc++ for backwards compatibility. However, if you are using GCC >= 5 your compiler is likely to be using the new CXX11 ABI by default (libstdc++11). This can be checked with the following command:

$ gcc -v 2>&1 | sed -n 's/.*\(--with-default-libstdcxx-abi=new\).*/\1/p'
--with-default-libstdcxx-abi=new

If you want Conan to use the new ABI, edit the default profile at ~/.conan/profiles/default adjusting compiler.libcxx=libstdc++11 or override this setting in the profile you are using.

If you are using the CMake build helper or the AutotoolsBuildEnvironment build helper Conan will automatically adjust the _GLIBCXX_USE_CXX11_ABI flag to manage the ABI.