柯南无法从新的构建服务器中找到包 ID

Posted

技术标签:

【中文标题】柯南无法从新的构建服务器中找到包 ID【英文标题】:Conan cannot find package id from new build server 【发布时间】:2020-10-06 15:08:01 【问题描述】:

我正在和柯南一起消费神器的一个项目。

工件在我的 Jenkins 管道中构建并上传到工件。

我有 2 台构建服务器,我想从旧的移到新的。

当我使用在新构建服务器中构建的工件时,我收到以下错误:

[2020-10-06T14:49:07.485Z] Requirements

[2020-10-06T14:49:07.485Z]     ext_TPC/11.8.128@prod/master from 'conan-extTPC' - Downloaded

[2020-10-06T14:49:07.485Z]     ext_cli_plugins/11.800.30@prod/master from 'conan-CliPlugins' - Downloaded

[2020-10-06T14:49:07.485Z]     ext_dotnet_plugins/11.800.44@prod/master from 'conan-DotNetPlugins' - Downloaded

[2020-10-06T14:49:07.485Z] Packages

[2020-10-06T14:49:07.485Z]     ext_TPC/11.8.128@prod/master:63da998e3642b50bee33f4449826b2d623661505 - Missing

[2020-10-06T14:49:07.485Z]     ext_cli_plugins/11.800.30@prod/master:63da998e3642b50bee33f4449826b2d623661505 - Download

[2020-10-06T14:49:07.485Z]     ext_dotnet_plugins/11.800.44@prod/master:63da998e3642b50bee33f4449826b2d623661505 - Download

[2020-10-06T14:49:07.485Z] 

[2020-10-06T14:49:07.485Z] Installing (downloading, building) binaries...

[2020-10-06T14:49:07.485Z] 

[2020-10-06T14:49:07.485Z] ERROR: Missing binary: ext_TPC/11.8.128@prod/master:63da998e3642b50bee33f4449826b2d623661505

[2020-10-06T14:49:07.485Z] ext_TPC/11.8.128@prod/master: WARN: Can't find a 'ext_TPC/11.8.128@prod/master' package for the specified settings, options and dependencies:

[2020-10-06T14:49:07.485Z] - Settings: arch=x86_64, build_type=Release, compiler=Visual Studio, compiler.runtime=MD, compiler.version=14, os=Windows

[2020-10-06T14:49:07.485Z] - Options: 

[2020-10-06T14:49:07.485Z] - Dependencies: 

[2020-10-06T14:49:07.485Z] - Requirements: 

[2020-10-06T14:49:07.485Z] - Package ID: 63da998e3642b50bee33f4449826b2d623661505

[2020-10-06T14:49:07.485Z] 

[2020-10-06T14:49:07.485Z] ERROR: Missing prebuilt package for 'ext_TPC/11.8.128@prod/master'

[2020-10-06T14:49:07.485Z] Try to build it from sources with "--build ext_TPC"

[2020-10-06T14:49:07.485Z] Or read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-missing-prebuilt-package"

[2020-10-06T14:49:07.485Z] 

script returned exit code 1

这是我从 BAT 文件运行的命令:

"conan install Scripts\NotCppConanFile.py -s os=Windows -s os_build=Windows -s arch=%ARCH% -s arch_build=%ARCH% -s build_type=%CONFIG% -s compiler="Visual Studio" -s compiler.version=14 -s compiler.runtime=%COMPILER_RUNTIME%
@IF NOT %ERRORLEVEL% == 0 EXIT /b %ERRORLEVEL%"
The Conan upload command: "conan upload ext_TPC/%PACKAGE_VERSION% --all -r=extTPC-conan --confirm"

这就是上传的输出:

"[2020-10-05T23:37:35.088Z] c:\jenkins\workspace\aster_CPM-TPC-master-full_master>conan export-pkg ./Scripts prod/master -f  

[2020-10-05T23:37:36.064Z] Auto detecting your dev setup to initialize the default profile (c:\Jenkins\workspace\aster_CPM-TPC-master-full_master\.conan\profiles\default)

[2020-10-05T23:37:36.335Z] Found Visual Studio 15

[2020-10-05T23:37:36.335Z] Default settings

[2020-10-05T23:37:36.335Z]  os=Windows

[2020-10-05T23:37:36.335Z]  os_build=Windows

[2020-10-05T23:37:36.335Z]  arch=x86_64

[2020-10-05T23:37:36.335Z]  arch_build=x86_64

[2020-10-05T23:37:36.335Z]  compiler=Visual Studio

[2020-10-05T23:37:36.335Z]  compiler.version=15

[2020-10-05T23:37:36.335Z]  build_type=Release

[2020-10-05T23:37:36.335Z] *** You can change them in c:\Jenkins\workspace\aster_CPM-TPC-master-full_master\.conan\profiles\default ***

[2020-10-05T23:37:36.335Z] *** Or override with -s compiler='other' -s ...s***

[2020-10-05T23:37:36.335Z] 

[2020-10-05T23:37:36.335Z] 

[2020-10-05T23:37:36.335Z] Exporting package recipe

[2020-10-05T23:37:36.335Z] ext_TPC/11.8.128@prod/master: A new conanfile.py version was exported

[2020-10-05T23:37:36.335Z] ext_TPC/11.8.128@prod/master: Folder: c:\Jenkins\workspace\aster_CPM-TPC-master-full_master\.conan\data\ext_TPC\11.8.128\prod\master\export

[2020-10-05T23:37:36.336Z] ext_TPC/11.8.128@prod/master: Exported revision: b4153452b7268b78be94d8acdfd58e5a

[2020-10-05T23:37:36.697Z] ext_TPC/11.8.128@prod/master: Forced build from source

[2020-10-05T23:37:36.697Z] Packaging to 6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7

[2020-10-05T23:37:36.697Z] ext_TPC/11.8.128@prod/master: Generating the package

[2020-10-05T23:37:36.697Z] ext_TPC/11.8.128@prod/master: Package folder c:\Jenkins\workspace\aster_CPM-TPC-master-full_master\.conan\data\ext_TPC\11.8.128\prod\master\package\6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7

[2020-10-05T23:37:36.697Z] ext_TPC/11.8.128@prod/master: Calling package()

[2020-10-05T23:37:36.697Z] ext_TPC/11.8.128@prod/master package(): Packaged 1 '.txt' file: 3rdPartyLicense.txt

[2020-10-05T23:37:36.697Z] ext_TPC/11.8.128@prod/master package(): Packaged 9 '.dll' files

[2020-10-05T23:37:36.697Z] ext_TPC/11.8.128@prod/master package(): Packaged 1 '.exe' file: CyberArk.TPC.exe

[2020-10-05T23:37:36.697Z] ext_TPC/11.8.128@prod/master package(): Packaged 1 '.config' file: CyberArk.TPC.exe.config

[2020-10-05T23:37:36.697Z] ext_TPC/11.8.128@prod/master: Package '6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7' created

[2020-10-05T23:37:36.697Z] ext_TPC/11.8.128@prod/master: Created package revision d5a1027449330f6e032dadf415327f0c

[2020-10-05T23:37:36.697Z] [HOOK - attribute_checker.py] pre_export(): WARN: Conanfile doesn't have 'url'. It is recommended to add it as attribute

[2020-10-05T23:37:36.697Z] [HOOK - attribute_checker.py] pre_export(): WARN: Conanfile doesn't have 'license'. It is recommended to add it as attribute

[2020-10-05T23:37:36.697Z] 

[2020-10-05T23:37:36.697Z] c:\jenkins\workspace\aster_CPM-TPC-master-full_master>REM **** the package to artifactory... 

[2020-10-05T23:37:36.697Z] 

[2020-10-05T23:37:36.697Z] c:\jenkins\workspace\aster_CPM-TPC-master-full_master>conan upload ext_TPC/11.8.128 --all -r=extTPC-conan --confirm 

[2020-10-05T23:37:37.666Z] Uploading to remote 'extTPC-conan':

[2020-10-05T23:37:37.666Z] 
Uploading ext_TPC/11.8.128@prod/master to remote 'extTPC-conan'                          

[2020-10-05T23:37:37.928Z] 
Uploading conanfile.py                                                
Uploading conanmanifest.txt                                           

[2020-10-05T23:37:37.928Z] 

[2020-10-05T23:37:37.928Z] 
Uploaded conan recipe 'ext_TPC/11.8.128@prod/master' to 'extTPC-conan': https://ca-dev-artifactory/artifactory/api/conan/extTPC-conan-latest-local

[2020-10-05T23:37:37.928Z] 
Uploading package 1/1: 6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 to 'extTPC-conan'        

[2020-10-05T23:37:37.928Z] Compressing package...

[2020-10-05T23:37:41.719Z] [==================================================]

[2020-10-05T23:37:41.719Z] 

[2020-10-05T23:37:41.719Z] 

[2020-10-05T23:37:42.292Z] 
Uploading conan_package.tgz                                           

[2020-10-05T23:37:42.292Z] 

[2020-10-05T23:37:42.555Z] 
Uploading conaninfo.txt                                               
Uploading conanmanifest.txt                                           

[2020-10-05T23:37:42.555Z]"

当我使用旧的构建服务器时,消耗正在工作。

我注意到,当我从旧构建服务器和新构建服务器上传工件时,包 ID 不同。

从网上的信息我了解到包id是我无法控制的哈希。

所以我的问题是,为什么柯南期待旧的哈希值,我该如何更改它?

【问题讨论】:

包ID应该相同。我需要查看上传命令和上传输出。你记得做conan upload --all所以二进制文件也被上传了吗?你能在你的 Artifactory 服务器 Web UI 中看到二进制文件吗? 我已经编辑了带有答案的帖子。是的,我可以在 Artifactory UI 中看到二进制文件,它们是不同的 【参考方案1】:

您尝试在新服务器中安装的二进制文件正在请求此二进制文件:

[2020-10-06T14:49:07.485Z] - Settings: arch=x86_64, build_type=Release, compiler=Visual Studio, compiler.runtime=MD, compiler.version=14, os=Windows

所以您尝试使用 compiler.version=14

安装它

您可以在创建的包中检查用于构建它的配置是:

[2020-10-05T23:37:36.335Z] Found Visual Studio 15
[2020-10-05T23:37:36.335Z] Default settings
[2020-10-05T23:37:36.335Z]  os=Windows
[2020-10-05T23:37:36.335Z]  os_build=Windows
[2020-10-05T23:37:36.335Z]  arch=x86_64
[2020-10-05T23:37:36.335Z]  arch_build=x86_64
[2020-10-05T23:37:36.335Z]  compiler=Visual Studio 
[2020-10-05T23:37:36.335Z]  compiler.version=15
[2020-10-05T23:37:36.335Z]  build_type=Release

compiler.version=15

默认配置文件是自动检测的,并使用系统中最新的 Visual Studio 编译器。对于生产用途,建议使用您自己的配置文件,而不是自动检测的配置文件。

确保您使用相同的配置来创建包并使用它。您可以根据需要创建和上传任意数量的配置,但是当您 install 它时,默认是它应该存在(可以使用 --build 从源请求构建它,但默认行为是找到一个匹配二进制或失败)

【讨论】:

我用编译器版本 14 打开了一个新的配置文件,一切正常!非常感谢!!!!

以上是关于柯南无法从新的构建服务器中找到包 ID的主要内容,如果未能解决你的问题,请参考以下文章

是否可以在柯南包管理器中使用 github 分支?

如何处理柯南服务器连接被拒绝?

如何在openSUSE Tumbleweed上安装柯南包管理器最正确?

柯南从容器内部失败,出现“sudo:未找到”错误

Cmake:使用柯南 pybind11 包

避免在柯南配置文件和 CMake 之间重复配置