Open Phibedy opened 7 years ago
A quick fix is to add this to the CMakeLists.txt for your project
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
Although the conan docs suggest that it should also work, for some reason specifying libstdc++ (vs libstdc++11) doesn't trigger this flag for me, which caused the build to fail with the same error you're seeing. If I have time I'll track down the root cause.
That is true, the add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
is automatically defined only when used from a conanfile.py recipe with the CMake
helper.
Check: https://github.com/conan-io/conan/blob/develop/conans/client/generators/cmake_common.py#L171
This only works when the CONAN_LIBCXX
is defined, which is done by the CMake
helper, typically used in the build()
method of the recipe.
The root cause is the high decoupling between conan and the build system. When you install conan dependencies you specify some settings, and a conanbuildinfo.cmake
is generated for those settings. But when you are building your project, your project settings must match the installed dependencies. For some of them, like the compiler and compiler version, the conanbuildinfo.cmake
already implements some checks, but not for the libcxx.
I have added an issue (https://github.com/conan-io/conan/issues/1202) to the main conan repo, to try to improve this (even if it doesn't look easy without breaking the low coupling). Thanks for the feedback!
Thanks for noticing! :) What's strange about this is that I built all dependencies from source with the same compiler and no specific settings or overrides, but still ended up with two different CXX11 versions somehow. I checked the conaninfo.txt file in the build dir of the Protobuf dependency and everything matched. Happy to provide any further details if you need them.
New ubuntu 16.04
Error
It works on ubuntu 14.04 with gcc 4.8 and 6.2.