conan
conan copied to clipboard
[question] are circle dependencies really so bad?
During implementation of a mold recipe, I have realized, that I am not able to build anything with a profile:
[settings] arch=x86_64 arch_build=x86_64 build_type=Release compiler=gcc compiler.version=11.2 compiler.cppstd=17 compiler.libcxx=libstdc++11 os=Linux os_build=Linux [options] [build_requires] mold/1.3.1 [env]
It's confusing, how can I use mold as a build tool? More than that, it's a totatlly valid operation to use mold for building mold.
- [x] I've read the CONTRIBUTING guide.
The thing is that such definition can easily go into infinite recursion. You cannot build mold, because you need mold, but you need to first build mold, etc.
The only possible way is to break the cycle, which can be done with some kind of conditional, as icu or other packages do:
def build_requirements(self):
if cross_building(self):
self.build_requires("mold/1.3.1")
That allows to do first a native build of mold/1.3.1 (assuming it doesn't need itself), and then it can be apply to bootstrap itself for another architecture. But doing something that breaks the infinite loop is necessary.