I was trying to build my project on the gitlab pipeline when I ran into some issues. While running the gitlab-ci.yml in the pipeline on AWS, out of two testing sections, one of them fails on the conan install step.
Successful section:
- conan install .. --build missing -s build_type=Release
Failed Section:
- conan install .. --build missing -s build_type=Debug
The only real difference between the two seems to be the conan build_type, as both use the same docker image. I am guessing that the error I get from this is due to the build_type change, making it try to find an extra package with an extra dependency (soci & mariadb-connector).
Error:
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
ConanFile:
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")
I did some searching online about conan package build_types, but was not able to understand the difference between the Debug and Release build_types from the official article. I also looked in my project conan file (above) and could not find any differences in dependencies between the debug and release build_types in it.
Can Conan Release and Debug build_types have different package dependencies, and where would I find these if they do?
If they cannot have different package dependencies, what is the difference between the Release and Debug build_types?
Please let me know if there is any additional information I need to provide.
Thanks!
Every conan install
with different configuration (settings, options) depends on different packages. As Conan has conditional dependencies, the dependency graph can be wildly different for different configurations
def requirements(self):
if self.settings.build_type == "Release":
self.requires("fastmath/1.0@myteam/channel")
Even if there aren't conditional dependencies, the binary packages used for every configuration are different. If the graph is using static libraries (option shared
, by default typically False
) the package binaries that are installed are different than if using shared libraries.
The same happens for Release and Debug packages. Though it is possible to create packages that contain both the Debug and Release artifacts, the default is that Release and Debug configurations are packaged in different packages.
In your case, the problem is that you have package for Release configuration, but not for the Debug one. The creators of that package didn't create and upload the Debug configuration.
By default Conan will also raise an Error when a binary package for your configuration is not found. Using --build
policies, you can tell Conan to build that package from sources, which is what is happening above. When the recipe tries to build from source, the first step is calling the source()
method, and this is trying to download some sources from the internet, and failing to do so. Effectively, the https://downloads.mariadb.org/f/connector-c-3.0.10/mariadb-connector-c-3.0.10-src.zip url throws a 404 Not found.
The recipe with that URL should be fixed to point to the right URL to be able to download the sources. It is also recommended that package binaries should in most cases be built in CI and uploaded to a server (Artifactory, the CE edition is free), not built in the developer machines.