如何 modify/affect/adapt 柯南依赖

Howto modify/affect/adapt conan dependencies

我不是柯南专家,所以也许有一个明显的解决方案。但这不是微不足道的,因为我为此苦苦挣扎了一段时间,找不到解决方案。

我们的项目需要镶木地板,我们通过 conan arrow 包包含它,conanfile.txt:

[requires]
arrow/2.0.0

[generators]
cmake

[options]
spdlog:=gcc
arrow:shared=False
arrow:parquet=True
arrow:fPIC=False
arrow:with_re2=False
arrow:with_protobuf=False
arrow:with_openssl=False
arrow:with_gflags=False
arrow:with_glog=False
arrow:with_grpc=False
arrow:with_utf8proc=False
arrow:with_zstd=False
arrow:with_bz2=False

(我把其他包都去掉了,但是没有那么多)

问题出在我们的 CI 我们收到错误:

...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
thrift/0.13.0: Downloaded recipe revision 0
openssl/1.1.1j: Not found in local cache, looking in remotes...
openssl/1.1.1j: Trying with 'conan-center'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
openssl/1.1.1j: Downloaded recipe revision 0
ERROR: openssl/1.1.1j: Cannot load recipe.
Error loading conanfile at '/conan/.conan/data/openssl/1.1.1j/_/_/export/conanfile.py': Current Conan version (1.32.1) does not satisfy the defined one (>=1.33.0).
CMake Error at cmake/conan.cmake:368 (message):
  Conan install failed='1'
Call Stack (most recent call first):
  cmake/conan.cmake:448 (conan_cmake_install)
  CMakeLists.txt:137 (conan_cmake_run)
-- Configuring incomplete, errors occurred!
See also "/builds/0/corsika/build/CMakeFiles/CMakeOutput.log".

正确指示在 CI 上我们使用带有 conan 1.32.1 的容器,这似乎与 openssl/1.1.1j 冲突,后者需要 >= 1.33.0.

我觉得这很烦人,因为我们明确地不想也不需要 openssl,我们为箭头关闭它(见上文)。

当我 运行 conan info . 我可以看到:

conanfile.txt
    ID: 33d8c2433f5e03548c5229121dbd4f82e354000d
    BuildID: None
    Requires:
        arrow/2.0.0
arrow/2.0.0
    ID: cd50fd05198137f0420bf6da1e5029dade26bc93
    BuildID: None
    Remote: conan-center=https://conan.bintray.com
    URL: https://github.com/conan-io/conan-center-index
    Homepage: https://arrow.apache.org/
    License: Apache-2.0
    Description: Apache Arrow is a cross-language development platform for in-memory data
    Topics: conan, arrow, memory
    Provides: arrow
    Recipe: Cache
    Binary: Missing
    Binary remote: conan-center
    Creation date: 2020-11-22 17:53:36 UTC
    Required by:
        conanfile.txt
    Requires:
        thrift/0.13.0
boost/1.75.0
    ID: d9d3e501899335bccbe5205508f9a4801424ce7d
    BuildID: None
    Remote: conan-center=https://conan.bintray.com
    URL: https://github.com/conan-io/conan-center-index
    Homepage: https://www.boost.org
    License: BSL-1.0
    Description: Boost provides free peer-reviewed portable C++ source libraries
    Topics: conan, boost, libraries, cpp
    Provides: boost
    Recipe: Cache
    Binary: Download
    Binary remote: conan-center
    Creation date: 2021-04-13 19:51:36 UTC
    Required by:
        thrift/0.13.0
    Requires:
        zlib/1.2.11
        bzip2/1.0.8
        libiconv/1.16
bzip2/1.0.8
    ID: da606cf731e334010b0bf6e85a2a6f891b9f36b0
    BuildID: None
    Remote: conan-center=https://conan.bintray.com
    URL: https://github.com/conan-io/conan-center-index
    Homepage: http://www.bzip.org
    License: bzip2-1.0.8
    Description: bzip2 is a free and open-source file compression program that uses the Burrows Wheeler algorithm.
    Topics: conan, bzip2, data-compressor, file-compression
    Provides: bzip2
    Recipe: Cache
    Binary: Cache
    Binary remote: conan-center
    Creation date: 2020-09-04 10:44:14 UTC
    Required by:
        boost/1.75.0
libevent/2.1.12
    ID: 6b0981c427aa0eb8bea05add2094df29ed639799
    BuildID: None
    Remote: conan-center=https://conan.bintray.com
    URL: https://github.com/conan-io/conan-center-index
    Homepage: https://github.com/libevent/libevent
    License: BSD-3-Clause
    Description: libevent - an event notification library
    Topics: conan, libevent, event
    Provides: libevent
    Recipe: Cache
    Binary: Cache
    Binary remote: conan-center
    Creation date: 2021-03-18 17:32:39 UTC
    Required by:
        thrift/0.13.0
    Requires:
        openssl/1.1.1j
libiconv/1.16
    ID: 6af9cc7cb931c5ad942174fd7838eb655717c709
    BuildID: None
    Remote: conan-center=https://conan.bintray.com
    URL: https://github.com/conan-io/conan-center-index
    Homepage: https://www.gnu.org/software/libiconv/
    License: LGPL-2.1
    Description: Convert text to and from Unicode
    Topics: libiconv, iconv, text, encoding, locale, unicode, conversion
    Provides: libiconv
    Recipe: Cache
    Binary: Cache
    Binary remote: conan-center
    Creation date: 2020-10-04 02:46:44 UTC
    Required by:
        boost/1.75.0
openssl/1.1.1j
    ID: 6af9cc7cb931c5ad942174fd7838eb655717c709
    BuildID: None
    Remote: conan-center=https://conan.bintray.com
    URL: https://github.com/conan-io/conan-center-index
    Homepage: https://github.com/openssl/openssl
    License: OpenSSL
    Description: A toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols
    Topics: conan, openssl, ssl, tls, encryption, security
    Provides: openssl
    Recipe: Cache
    Binary: Cache
    Binary remote: conan-center
    Creation date: 2021-03-26 21:05:40 UTC
    Required by:
        thrift/0.13.0
        libevent/2.1.12
thrift/0.13.0
    ID: 44b3a17b9712eb98c7cab65c26ec70335992ff20
    BuildID: None
    Remote: conan-center=https://conan.bintray.com
    URL: https://github.com/conan-io/conan-center-index
    Homepage: https://github.com/apache/thrift
    License: Apache-2.0
    Description: Thrift is an associated code generation mechanism for RPC
    Topics: conan, thrift, serialization, rpc
    Provides: thrift
    Recipe: Cache
    Binary: Download
    Binary remote: conan-center
    Creation date: 2021-03-30 05:58:58 UTC
    Required by:
        arrow/2.0.0
    Requires:
        boost/1.75.0
        openssl/1.1.1j
        zlib/1.2.11
        libevent/2.1.12
zlib/1.2.11
    ID: 6af9cc7cb931c5ad942174fd7838eb655717c709
    BuildID: None
    Remote: conan-center=https://conan.bintray.com
    URL: https://github.com/conan-io/conan-center-index
    Homepage: https://zlib.net
    License: Zlib
    Description: A Massively Spiffy Yet Delicately Unobtrusive Compression Library (Also Free, Not to Mention Unencumbered by Patents)
    Topics: conan, zlib, compression
    Provides: zlib
    Recipe: Cache
    Binary: Cache
    Binary remote: conan-center
    Creation date: 2020-11-15 04:53:34 UTC
    Required by:
        thrift/0.13.0
        boost/1.75.0

看来之所以引入 openssl 是因为 thrift 和 libevent。

鉴于我们无法更改我们的 CI 容器,因为那样我们基本上会放弃对我们需要支持的平台的支持,那么这里的解决方案是什么?

(注脚,我们使用的容器和系统都不是很旧,所以我相信这个问题很容易影响到很多用户。我搜索了一段时间没有找到任何解决方案。)

明显推荐:Update柯南至最新版本(1.35.1)。

pip install -U conan

Conan Center Index(所有官方)中的包未被任何旧版本阻止,实际上它是强制性的,必须使用最新的 Conan 版本进行测试。柯南中心索引假定您也是 运行 最新的柯南客户端版本:

https://github.com/conan-io/conan-center-index/blob/41d4fbb8c218f9d938ccb8b9d888bff52002e62e/.github/PULL_REQUEST_TEMPLATE.md#L9

https://github.com/conan-io/conan-center-index/blob/c060f7086f3745361795fb6379bd6f0bac000bab/docs/how_to_add_packages.md#L57

why openssl depends on conan version in the first place? Can't this we fixed or worked around?

每个新版本都会引入新的 Conan 功能。您不能因为正在食用它们而简单地更改食谱。即使您下载食谱并删除该检查,它也会失败,因为您的 Conan 客户端版本不支持该食谱中的某些 method/feature。

can we affect the dependency tree of arrow in a way to avoid any reference to openssl? E.g. provide dedicated versions of thrift/libevent that come without openssl (if this is even possible)?

可以,但不推荐。您可以在 conanfile.txt 中声明 arrow 使用的其他包版本,这将强制柯南使用您的版本。

Are there any other options?

是的,不要尝试解决方法,做正确的事,更新您的客户端版本。