【问题标题】:Howto modify/affect/adapt conan dependencies如何修改/影响/调整柯南依赖项
【发布时间】:2021-04-23 09:10:28
【问题描述】:

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

我们的项目需要镶木地板,我们通过 conan 箭头包包含它,例如 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 的容器,这似乎与想要 >= 1.33.0 的 openssl/1.1.1j 冲突。

我觉得这很烦人,因为我们明确不想要也不需要 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 被引入的原因是因为节俭和 libevent。

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

  • 为什么openssl首先依赖柯南版本?我们不能修复或解决这个问题吗?

  • 我们能否以某种方式影响箭头的依赖树以避免对 openssl 的任何引用?例如。提供不带 openssl 的专用 thrift/libevent 版本(如果可能的话)?

  • 还有其他选择吗?

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

【问题讨论】:

  • 来自文档:“这意味着像 ConanCenter 这样的公共存储库假定使用最新版本的柯南客户端,并且使用旧版本可能会导致使用新版本创建的包和配方失败客户端的版本。” (docs.conan.io/en/latest/introduction.html#stable)

标签: conan


【解决方案1】:

显而易见的建议: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

为什么openssl首先依赖柯南版本?我们不能修复或解决这个问题吗?

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

我们能否以某种方式影响箭头的依赖关系树以避免对 openssl 的任何引用?例如。提供不带 openssl 的专用 thrift/libevent 版本(如果可能的话)?

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

还有其他选择吗?

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

【讨论】:

  • 谢谢。这很有帮助,不幸的是,这意味着更新我们的 docker 容器,因为我们将柯南数据保存在容器中。但这是由于我们的设置。
  • 您不应该将柯南数据保存在您的容器中。 Docker 不是虚拟机,您可以运行、完成和删除您的容器。您的柯南数据应存储在外部卷中。看看官方的柯南 Docker 镜像:github.com/conan-io/conan-docker-tools#use-the-images-locally
  • 我会考虑将其用于本地使用,但我们仅将容器用于 gtilab-CI 并且拥有全球分布的 Runner 硬件。将柯南数据添加到容器中的唯一要点是增加运行器的吞吐量并节省 CI 上的资源。 gitlab-CI 的工件系统通常会导致性能非常差(尝试过),而 docker 在处理我们的需求方面要好得多(因此 gitlab-CI 缓存在我们的场景中不是很实用)。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多