How do I run "conan init" and disable the warning about GCC ABI (libstdc++11) compatibility?

Viewed 903

Every time I run conan init in a fresh docker container, I get the following warning:

************************* WARNING: GCC OLD ABI COMPATIBILITY ***********************

Conan detected a GCC version > 5 but has adjusted the 'compiler.libcxx' setting to
'libstdc++' for backwards compatibility.
Your compiler is likely using the new CXX11 ABI by default (libstdc++11).

If you want Conan to use the new ABI for the default profile, run:

    $ conan profile update settings.compiler.libcxx=libstdc++11 default

Or edit '/home/smith/.conan/profiles/default' and set compiler.libcxx=libstdc++11

************************************************************************************

It's annoying, and distracting. Redundant, too, since the very next command I run in the script is the one for setting the ABI, as suggested in the warning.

conan profile update settings.compiler.libcxx=libstdc++11 default

Is there a way to disable the warning, to avoid seeing it?

2 Answers

This warning can be skipped when CONAN_V2_MODE is on: e.g.:

conan:~$ export CONAN_V2_MODE=1
conan:~$ conan config init
WARN: Remotes registry file missing, creating default one in /home/conan/.conan/remotes.json
Auto detecting your dev setup to initialize the default profile (/home/conan/.conan/profiles/default) 
Found gcc 9.2
gcc>=5, using the major as version
gcc C++ standard library: libstdc++11
Default settings
    os=Linux
    os_build=Linux
    arch=x86_64
    arch_build=x86_64
    compiler=gcc
    compiler.version=9
    compiler.libcxx=libstdc++11
    build_type=Release
*** You can change them in /home/conan/.conan/profiles/default ***
*** Or override with -s compiler='other' -s ...s***

But that variable also activates some other conan v2 options. You can read more here: https://docs.conan.io/en/latest/reference/conan_v2_mode.html

The best I've been able to find is to use more commands, and manually specify the values. But then I lose the auto-detection of the compiler type and version.

Instead of just:

conan init

I have to create a profile fill in the values:

conan profile new default
conan profile update settings.os=Linux default
conan profile update settings.os_build=Linux default
conan profile update settings.arch=x86_64 default
conan profile update settings.arch_build=x86_64 default
conan profile update settings.compiler=gcc default
conan profile update settings.compiler.version=9 default
conan profile update settings.compiler.libcxx=libstdc++11 default
conan profile update settings.build_type=Release default

Which is a lot of commands to run. If you are looking at that and thinking it's a good idea, I'd suggest also looking at conan config install, to load the profile from another file.

Related