conan icon indicating copy to clipboard operation
conan copied to clipboard

[question] Mixed profile dependency graph

Open Andre-Heil-Bose opened this issue 1 year ago • 1 comments

What is your question?

Hello!

I am using Conan 1.62.0 and I have a question about the following dependency graph:

conan_deps

In this graph each box represents a conan repo which generates a package. Each repo has a list of dependencies, such that xA depends on xB, etc. In this graph there are two profiles, profile x which builds for architecture x, and profile y which builds for architecture y. Some repos only build for profile x and some only build for profile y and one builds for both.

The difficulty I'm having is that xB depends on yB. It just wants to get the latest binary package from yB. I've been able to do this by doing self.info.clear() in the package_id function of yB.

However yA also depends on yB. If xyA or yC change, I'd like yA to know that it must rebuild yB. But since the requires has been cleared from yB in the package_id it doesn't know that it must be rebuilt.

How can I set this up such that xB is able to grab the binary package from yB while also preserving the requires info for yA?

The only approach I can think of is that yB must generate two packages, one with the requires info for yA and one without for xB.

Let me know if there are any better approaches!

Thanks you!

Have you read the CONTRIBUTING guide?

  • [X] I've read the CONTRIBUTING guide

Andre-Heil-Bose avatar Feb 13 '24 20:02 Andre-Heil-Bose

Hi @Andre-Heil-Bose

Thanks for your question.

I am not sure if I fully understood the case, but I'll try.

Conan is a "development" C/C++ package manager, that means that when some dependencies are installed from a conanfile, they are intended to be used in the same application or shared library. That means that the dependencies will be binary compatible and they can be linked together. That means that the same package can only be used in one architecture. Typical use case, we are building an application for Linux-armv8, and this application depends on zlib/1.3, this zlib binary package must be compiled with armv8 architecture, and it is not possible to have my application depend simultaneously on one binary for zlib built with armv8 and another zlib binary built for x86_64, as it is impossible to link them together.

Said that, Conan 1 is most likely impossible to achieve this, but Conan 2.0 might be bended a bit more and maybe the "requirement traits" can be used to represent something in this line. Probably not straightforward, and it might require some customization of options for architectures, but might be doable.

It would be good to understand what is the use case, because it is not typical C++ building and linking. If not, what does it mean? I guess that the standard build system integrations like CMakeToolchain or CMakeDeps are not used at all? What does a package that depends on the same package with different architectures do with them?

memsharded avatar Feb 14 '24 00:02 memsharded