conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.17k stars 974 forks source link

[question] override a package dependency to preinstalled library in SDK #15844

Closed dornbirndevelops closed 6 months ago

dornbirndevelops commented 6 months ago

What is your question?

Hi!

My project requires the grpc library which in turn requires openssl. I compile grpc using a Yocto SDK toolchain. This toolchain also delivers openssl as one of the preinstalled libraries inside the SDK sysroot. Now I would like to build grpc against the openssl library that comes with the SDK. In other platforms, the openssl library offered by conan should continue to be used.

This problem can be applied to other libraries, so I will keep the question generic. If a library Y has a dependency X from conan, how can I configure a build of Y to use the systems X library?

Important side note: My project still uses conan 1.x.

Is it possible to "remove" a dependency from a dependency tree? I know overrides exist, but this is more of a substitution. Or do I need to patch the grpc recipe such that I can configure this dependency via options?

Thanks in advance!

Have you read the CONTRIBUTING guide?

memsharded commented 6 months ago

Hi @dornbirndevelops

Thanks for your question.

I think you are asking exactly for this feature: https://blog.conan.io/2024/02/20/Conan-2-graph-features.html

The only issue is that it is a Conan 2 feature, this was not possible with Conan 1 (so I am afraid it is also impossible to backport it now), this is one of the reasons Conan 2 was necessary, so the new architecture and designed allowed us to deliver these demanded features.

The only way to do this in Conan 1 is modifying the recipes via options (or maybe better conf), but that might a bit too dirty, I'd focus the efforts on upgrading to Conan 2 to be able to use the built-in functionality.

dornbirndevelops commented 6 months ago

thank you for the quick reply @memsharded, I will consider my options then. closing this as answered.