-
Notifications
You must be signed in to change notification settings - Fork 959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] Static dependencies #9902
Comments
One of the main problems with build_requires is that they cannot affect the package_id of the consumers, by definition. So that is a very bad situation for a shared library that depends on a static library regarding the re-build, build-order, CI, etc. As it is not that typical to mix shared-static, and build-systems can also filter what they are linking, it might be better to use regular Furthermore, Conan 2.0 will explicitly model these relations, and will avoid propagating the linkage requirement downstream, automatically. |
I've just discovered the |
|
So what is the alternative? Lets say I have a library/package libfoo, which depends on a very large package, providing both static and dynamic libraries -- lets say, IPP. libfoo takes care, through cmake settings to not link with the shared libraries. But it does bring IPP through a Then I have a libbar, which depends on libfoo. libbar now pulls in IPP through conan graph -- and as the result its product now depends on IPP shared libraries. Didn't plan on shipping those -- yet there they are. If private clause on |
This keeps coming up. And I don't think a good solution currently exists, other than using build_requires with |
Hi w3sip, have you got any work around? I have a libA, which depends on boost. As boost is quite a large dependency, I hope it can be compiled totally in libA via static library. In that way, I needn't install boost binary any more when using libA. |
@wjswjq - unfortunately, no great solutions. |
@w3sip, Thanks a lot. |
@memsharded - I must be misunderstanding something very fundamental about Conan dependency chain management, even with shared dependencies, not just static. Let me give you an example. Lets say I have a project We then have However, now if we look a libA with This causes a situation, where OpenCV upgrade, which should cause a rebuild of libswissknife only causes the need to rebuild/upgrade the entire dependency chain. Is there any way to avoid it? |
Can you please clarify? It is not very clear. In any case, Conan 2.0 brings a new dependencies and graph model, that allows much better management of things like static dependencies. I'd recommend having a look to https://www.youtube.com/watch?v=kKGglzm5ous, trying things in the Conan 2.0 beta and reporting against that. |
When we started with Conan, the understanding we developed is that if dependency is only needed during build (but not necessarily for the CI/build environment), this dependency was referenced via
build_requires
, and if that dependency is used during runtime, it is referenced viarequires
.The documentation for 1.41.0 is pretty explicit in disproving this believe. And that makes sense in context of cross-building. However, how do we deal with requirements that are not necessary downstream?
For example, lets consider a scenario, where my shared library libfoo links with static zlib. libbar then depends on libfoo, but, as a transitive dependency, zlib package will be downloaded anytime during
conan install
for libbar. Is there a way to prevent this, and indicate that a particularrequires
dependency should not be visible to consumers of the recipe using it?The text was updated successfully, but these errors were encountered: