conan icon indicating copy to clipboard operation
conan copied to clipboard

[question/bug?] create profile for clang and _GLIBCXX_USE_CXX11_ABI

Open ibis-hdl opened this issue 2 years ago • 2 comments

Following [question] Is libstdc++11 used in Linux clang? #7002 Clang is also affected from C++11 ABI library 'problem'.

I my project, I got in (ubuntu 22) CLI

$ export CONAN_V2_MODE=1
$ CXX=clang++ conan profile new --detect --force clang
$ CXX=g++ conan profile new --detect --force gcc
$ grep -H libcxx ~/.conan/profiles/[cg]*
/home/vscode/.conan/profiles/clang:compiler.libcxx=libstdc++
/home/vscode/.conan/profiles/gcc:compiler.libcxx=libstdc++11

Obviously, this works in Conan v2 mode correct for GCC, but not for Clang, isn't it? Not shure if this is a bug or I do miss something ...

Conan is version 1.51.2

ibis-hdl avatar Aug 16 '22 10:08 ibis-hdl

Hi @ibis-hdl - thank you for reporting this. Indeed, on most recent Linux distros that also provide clang, it is typical that clang uses the GNU C++ Library (libstdc++), which is the one that sets the _GLIBCXX_USE_CXX11_ABI macro to 1 by default (from what I have observed, the compiler itself doesn't).

In general (regardless of this), we do recommend to use profiles explicitly rather than relying on auto-detection. If you need to share Conan configuration across multiple users, we recommend using the conan config command, you can read about it here: https://docs.conan.io/en/latest/reference/commands/consumer/config.html?highlight=config#conan-config-install

We have been very cautious to change the defaults in Conan 1.x to prevent unintended breakages for users with existing Conan installations. However, we will issue a fix in Conan 2.0, thanks so much for reporting this!

jcar87 avatar Aug 18 '22 08:08 jcar87

Thanks for your effort. I assume I have to cut off conan-cmake here, since it relies on auto-detected profiles. The sharm of this is, that I've only one CLI call of the cmake exe ...

ibis-hdl avatar Aug 31 '22 17:08 ibis-hdl

Hi @ibis-hdl

I have checked this, and CONAN_V2_MODE is no longer being maintained in 1.X. The smart detection that CONAN_V2_MODE introduces in 1.X has been completely removed in 2.0, so it doesn't make much sense to try to change it in 1.X if it is going to be removed.

The default in 2.0 is being improved in this PR https://github.com/conan-io/conan/pull/12251 (still not to rely on it, but use your own profiles for production, not auto-detected ones), that will close this ticket, thanks for reporting.

memsharded avatar Oct 05 '22 21:10 memsharded

Closed by https://github.com/conan-io/conan/pull/12251

memsharded avatar Oct 06 '22 10:10 memsharded