我正在尝试使用命令
expat/2.5.0
安装 python -m conans.conan install expat/2.5.0@ -pr <profile>
,其中我的配置文件在两种情况下都是相同的,但仅使用 compiler.version=193
和 compiler.version=194
。这主要适用于 Windows 环境中的msvc
。
执行安装时我收到
expat/2.5.0: Main binary package 'bb496eac3d86e85e9282f15fbff7e4d38fef491e' missing. Using compatible package '8e589e066a19f700666be77ed94ff8e8bc88ee10'
和
expat/2.5.0: Main binary package '35008919e57d73db0c4e0b6ee1736abd51fe0f4f' missing. Using compatible package '8e589e066a19f700666be77ed94ff8e8bc88ee10'
但是,在阅读了 ABI 兼容性文档,然后阅读了 expat 的 conanfile.py 后,我无法修改任何表明 194 和 193 二进制兼容的代码。谁能向我解释如何评估这些值以获得不同编译器版本的相同 packageID ?我期待文档中解释的行,例如,
from conans import ConanFile
class Pkg(ConanFile):
settings = "os", "compiler", "arch", "build_type"
def package_id(self):
if self.settings.compiler == "gcc" and self.settings.compiler.version == "4.9":
for version in ("4.8", "4.7"):
compatible_pkg = self.info.clone()
compatible_pkg.settings.compiler.version = version
self.compatible_packages.append(compatible_pkg)
但是,我在
expat
conanfile.py 中没有看到类似的内容
从
msvc
compiler.version=194到compiler.version=193的回退仅在柯南2中实现,在柯南1中没有实现。
相关功能在
compatibility.py
插件中,查看此页面
if compiler == "msvc":
msvc_fallback = {"194": "193"}.get(compiler_version)
if msvc_fallback:
factors.append([{"compiler.version": msvc_fallback}])
此插件设计为用户可自定义,因此您可以从插件中删除这些行。记得删除第一行注释:
# This file was generated by Conan. Remove this comment if you edit this file or Conan
# will destroy your changes.
否则下一个柯南更新可能会用干净的默认文件替换您的更改。 回想一下,
compatibility.py
插件可以使用 conan config install/install-pkg
命令共享和分发(与其他文件一起)。