微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何运行“conan init”并禁用有关 GCC ABI (libstdc++11) 兼容性的警告?

如何解决如何运行“conan init”并禁用有关 GCC ABI (libstdc++11) 兼容性的警告?

每次在新的 docker 容器中运行 conan init 时,都会收到以下警告:

************************* 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

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

这很烦人,而且让人分心。也是冗余的,因为我在脚本中运行的一个命令是用于设置 ABI 的命令,正如警告中所建议的那样。

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

有没有办法禁用警告,避免看到它?

解决方法

CONAN_V2_MODE 开启时可以跳过此警告:例如:

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***

但该变量也会激活其他一些 conan v2 选项。您可以在此处阅读更多信息:https://docs.conan.io/en/latest/reference/conan_v2_mode.html

,

我能找到的最好方法是使用更多命令,并手动指定值。但是后来我失去了对编译器类型和版本的自动检测。

而不仅仅是:

conan init

我必须创建一个填充值的配置文件:

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

要运行的命令很多。如果您正在查看并认为这是一个好主意,我建议您还查看 conan config install,以从另一个文件加载配置文件。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。