C++ Conan Debug和Release Build_类型是否具有不同的包依赖关系?
C++ Conan Debug和Release Build_类型是否具有不同的包依赖关系?,c++,docker,conan,C++,Docker,Conan,背景: 当我试图在gitlab管道上构建我的项目时,遇到了一些问题。在AWS的管道中运行gitlab-ci.yml时,在两个测试部分中,有一个在conan安装步骤中失败 成功部分: - conan install .. --build missing -s build_type=Release - conan install .. --build missing -s build_type=Debug mariadb-connector-c/3.0.10@omitted/stable: C
背景:
当我试图在gitlab管道上构建我的项目时,遇到了一些问题。在AWS的管道中运行gitlab-ci.yml时,在两个测试部分中,有一个在conan安装步骤中失败 成功部分:
- conan install .. --build missing -s build_type=Release
- conan install .. --build missing -s build_type=Debug
mariadb-connector-c/3.0.10@omitted/stable: Configuring sources in /root/.conan/data/mariadb-connector-c/3.0.10/omitted/stable/source
WARN: OpenSSL/1.1.0j@conan/stable: requirement zlib/1.2.11@conan/stable overridden by mariadb-connector-c/3.0.10@omitted/stable to zlib/1.2.11
OpenSSL/1.1.0j@conan/stable: WARN: ----------MAKE OPENSSL 1.1.0j-------------
ERROR: mariadb-connector-c/3.0.10@omitted/stable: Error in source() method, line 23
"https://downloads.mariadb.org/f/connector-c-{0}/mariadb-connector-c-{0}-src.zip".format(self.version))
NotFoundException: Not found: https://downloads.mariadb.org/f/connector-c-3.0.10/mariadb-connector-c-3.0.10-src.zip
from conans import ConanFile, CMake
class ProjectConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "rfc/2.2@ommited/stable", "soci/3.2.3@ommited/stable", "libxml2/2.9.9", "zlib/1.2.11"
default_options = {"qt:openssl": "False", "qt:with_sqlite3": "False",
"qt:with_mysql": "False", "qt:with_odbc": "False", "qt:with_pq": "False"}
generators = "cmake"
def requirements(self):
if self.settings.os == "Windows":
self.requires("libiconv/1.15@bincrafters/stable")
self.requires("qt/5.13.2@bincrafters/stable")
def configure(self):
if self.settings.os == "Windows":
self.generators.append("qt")
def imports(self):
if self.settings.os == "Windows":
self.copy("*.dll", dst="bin", src="bin")
self.copy("*.pdb", dst="bin", src="bin")
self.copy("*.dylib*", dst="bin", src="lib")
self.copy("*.so*", dst="lib", src="lib")
失败部分:
- conan install .. --build missing -s build_type=Release
- conan install .. --build missing -s build_type=Debug
mariadb-connector-c/3.0.10@omitted/stable: Configuring sources in /root/.conan/data/mariadb-connector-c/3.0.10/omitted/stable/source
WARN: OpenSSL/1.1.0j@conan/stable: requirement zlib/1.2.11@conan/stable overridden by mariadb-connector-c/3.0.10@omitted/stable to zlib/1.2.11
OpenSSL/1.1.0j@conan/stable: WARN: ----------MAKE OPENSSL 1.1.0j-------------
ERROR: mariadb-connector-c/3.0.10@omitted/stable: Error in source() method, line 23
"https://downloads.mariadb.org/f/connector-c-{0}/mariadb-connector-c-{0}-src.zip".format(self.version))
NotFoundException: Not found: https://downloads.mariadb.org/f/connector-c-3.0.10/mariadb-connector-c-3.0.10-src.zip
from conans import ConanFile, CMake
class ProjectConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "rfc/2.2@ommited/stable", "soci/3.2.3@ommited/stable", "libxml2/2.9.9", "zlib/1.2.11"
default_options = {"qt:openssl": "False", "qt:with_sqlite3": "False",
"qt:with_mysql": "False", "qt:with_odbc": "False", "qt:with_pq": "False"}
generators = "cmake"
def requirements(self):
if self.settings.os == "Windows":
self.requires("libiconv/1.15@bincrafters/stable")
self.requires("qt/5.13.2@bincrafters/stable")
def configure(self):
if self.settings.os == "Windows":
self.generators.append("qt")
def imports(self):
if self.settings.os == "Windows":
self.copy("*.dll", dst="bin", src="bin")
self.copy("*.pdb", dst="bin", src="bin")
self.copy("*.dylib*", dst="bin", src="lib")
self.copy("*.so*", dst="lib", src="lib")
两者之间唯一的真正区别似乎是柯南build_类型,因为两者使用相同的docker图像。我猜我从中得到的错误是由于build_类型的改变,使得它试图找到一个具有额外依赖项的额外包(soci&mariadb connector)
错误:
- conan install .. --build missing -s build_type=Release
- conan install .. --build missing -s build_type=Debug
mariadb-connector-c/3.0.10@omitted/stable: Configuring sources in /root/.conan/data/mariadb-connector-c/3.0.10/omitted/stable/source
WARN: OpenSSL/1.1.0j@conan/stable: requirement zlib/1.2.11@conan/stable overridden by mariadb-connector-c/3.0.10@omitted/stable to zlib/1.2.11
OpenSSL/1.1.0j@conan/stable: WARN: ----------MAKE OPENSSL 1.1.0j-------------
ERROR: mariadb-connector-c/3.0.10@omitted/stable: Error in source() method, line 23
"https://downloads.mariadb.org/f/connector-c-{0}/mariadb-connector-c-{0}-src.zip".format(self.version))
NotFoundException: Not found: https://downloads.mariadb.org/f/connector-c-3.0.10/mariadb-connector-c-3.0.10-src.zip
from conans import ConanFile, CMake
class ProjectConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "rfc/2.2@ommited/stable", "soci/3.2.3@ommited/stable", "libxml2/2.9.9", "zlib/1.2.11"
default_options = {"qt:openssl": "False", "qt:with_sqlite3": "False",
"qt:with_mysql": "False", "qt:with_odbc": "False", "qt:with_pq": "False"}
generators = "cmake"
def requirements(self):
if self.settings.os == "Windows":
self.requires("libiconv/1.15@bincrafters/stable")
self.requires("qt/5.13.2@bincrafters/stable")
def configure(self):
if self.settings.os == "Windows":
self.generators.append("qt")
def imports(self):
if self.settings.os == "Windows":
self.copy("*.dll", dst="bin", src="bin")
self.copy("*.pdb", dst="bin", src="bin")
self.copy("*.dylib*", dst="bin", src="lib")
self.copy("*.so*", dst="lib", src="lib")
ConanFile:
- conan install .. --build missing -s build_type=Release
- conan install .. --build missing -s build_type=Debug
mariadb-connector-c/3.0.10@omitted/stable: Configuring sources in /root/.conan/data/mariadb-connector-c/3.0.10/omitted/stable/source
WARN: OpenSSL/1.1.0j@conan/stable: requirement zlib/1.2.11@conan/stable overridden by mariadb-connector-c/3.0.10@omitted/stable to zlib/1.2.11
OpenSSL/1.1.0j@conan/stable: WARN: ----------MAKE OPENSSL 1.1.0j-------------
ERROR: mariadb-connector-c/3.0.10@omitted/stable: Error in source() method, line 23
"https://downloads.mariadb.org/f/connector-c-{0}/mariadb-connector-c-{0}-src.zip".format(self.version))
NotFoundException: Not found: https://downloads.mariadb.org/f/connector-c-3.0.10/mariadb-connector-c-3.0.10-src.zip
from conans import ConanFile, CMake
class ProjectConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "rfc/2.2@ommited/stable", "soci/3.2.3@ommited/stable", "libxml2/2.9.9", "zlib/1.2.11"
default_options = {"qt:openssl": "False", "qt:with_sqlite3": "False",
"qt:with_mysql": "False", "qt:with_odbc": "False", "qt:with_pq": "False"}
generators = "cmake"
def requirements(self):
if self.settings.os == "Windows":
self.requires("libiconv/1.15@bincrafters/stable")
self.requires("qt/5.13.2@bincrafters/stable")
def configure(self):
if self.settings.os == "Windows":
self.generators.append("qt")
def imports(self):
if self.settings.os == "Windows":
self.copy("*.dll", dst="bin", src="bin")
self.copy("*.pdb", dst="bin", src="bin")
self.copy("*.dylib*", dst="bin", src="lib")
self.copy("*.so*", dst="lib", src="lib")
我在网上搜索了一些,但无法从官方文章中理解调试和发布构建类型之间的区别。我还查看了我的项目conan文件(如上所述),在其中的调试和发布构建类型之间的依赖关系中找不到任何差异
问题: 柯南版本和调试版本类型是否有不同的包依赖关系,如果有,我会在哪里找到它们 如果它们不能具有不同的包依赖关系,那么发布和调试构建类型之间的区别是什么 请让我知道,如果有任何额外的信息,我需要提供
谢谢 每个具有不同配置(设置、选项)的
conan安装取决于不同的软件包。由于Conan具有条件依赖性,因此对于不同的配置,依赖关系图可能会大不相同
def requirements(self):
if self.settings.build_type == "Release":
self.requires("fastmath/1.0@myteam/channel")
即使没有条件依赖,用于每个配置的二进制软件包也是不同的。如果图形使用静态库(选项shared
,默认情况下通常为False
),则安装的包二进制文件与使用共享库的包二进制文件不同
发布包和调试包也是如此。尽管可以创建包含调试和发布工件的包,但默认情况下,发布和调试配置打包在不同的包中
在您的情况下,问题是您有用于发布配置的包,但没有用于调试配置的包。该包的创建者没有创建并上载调试配置
默认情况下,当未找到配置的二进制软件包时,Conan也会引发错误。使用--build
策略,您可以告诉柯南从源代码构建该包,这就是上面发生的事情。当配方尝试从源代码构建时,第一步是调用source()
方法,这是尝试从internet下载一些源代码,但没有成功。实际上,url抛出了一个404 Not found
带有该URL的配方应该固定为指向正确的URL,以便能够下载源代码。还建议在大多数情况下,软件包二进制文件应在CI中构建并上载到服务器(Artifactory,CE版是免费的),而不是在开发人员机器中构建。每个具有不同配置(设置、选项)的conan安装取决于不同的软件包。由于Conan具有条件依赖性,因此对于不同的配置,依赖关系图可能会大不相同
def requirements(self):
if self.settings.build_type == "Release":
self.requires("fastmath/1.0@myteam/channel")
即使没有条件依赖,用于每个配置的二进制软件包也是不同的。如果图形使用静态库(选项shared
,默认情况下通常为False
),则安装的包二进制文件与使用共享库的包二进制文件不同
发布包和调试包也是如此。尽管可以创建包含调试和发布工件的包,但默认情况下,发布和调试配置打包在不同的包中
在您的情况下,问题是您有用于发布配置的包,但没有用于调试配置的包。该包的创建者没有创建并上载调试配置
默认情况下,当未找到配置的二进制软件包时,Conan也会引发错误。使用--build
策略,您可以告诉柯南从源代码构建该包,这就是上面发生的事情。当配方尝试从源代码构建时,第一步是调用source()
方法,这是尝试从internet下载一些源代码,但没有成功。实际上,url抛出了一个404 Not found
带有该URL的配方应该固定为指向正确的URL,以便能够下载源代码。还建议在大多数情况下,软件包二进制文件应在CI中构建并上载到服务器(Artifactory,CE版是免费的),而不是在开发人员机器中构建。如果有人需要,我还可以提供完整的gitlab-ci.yml命令。发布版本可以作为平台的预构建包提供,但调试不可用,版本失败,因为配方中的源位置似乎不正确incorrect@AlanBirtles是的,我们在源位置没有mariadb 3.0.10,但是你知道我在哪里可以找到调试构建类型的配方吗?如果有人需要,我也可以提供完整的gitlab-ci.yml命令。发布构建可以作为平台的预构建包提供,但调试不是,生成失败,因为配方中的源位置似乎不正确incorrect@AlanBirtles是的,我们在源代码位置没有mariadb 3.0.10,但是您知道我在哪里可以找到调试构建类型的配方吗?很好的解释。那么调试make_类型中可能缺少包?我将更新artifactory源并重试。此外,如果我使用与发布版本匹配的debug requires版本更新我的requirements函数,这会修复问题吗