-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
libprotobuf-static dependencies #164
Comments
This setup has had a long discussion (in particular w.r.t. CMake setup), see here (I'm linking the summary because the thread is long). In short, to solve this, it's probably necessary to add something like: - name: libprotobuf-static
script: build-lib.sh # [unix]
script: build-lib.bat # [win]
build:
+ always_include_files:
+ # Must overwrite the CMake metadata from shared libprotobuf
+ - lib/cmake/protobuf/ # [unix]
+ - Library/lib/cmake/protobuf/ # [win]
ignore_run_exports_from:
- jsoncpp
requirements: PRs welcome. |
Hi @h-vetinari, Thank you for the pointers and advice. Based on the linked discussion it sounds like an ecosystem-wide philosophical problem than a quick fix. I will try to tackle it on my own in the project itself. |
FWIW, the fix I proposed would be "legitimate" (i.e. in line with the outcome of that discussion), and not a quick fix per se. There are other work-arounds how to enforce using the static libraries (IIRC, micromamba was doing this a lot, see e.g. here). |
Yes, it would work. My reservation is that still someone may want to use both static and dynamic versions in the save env, like your project X depends on A-static and B, and B depends on A-dynamic. So you end up with a conflict/inconsistency in the system. |
Actually that would work. The rule is simple: if you depend on libfoo, you always get the static one. If you depend on libfoo-static, you get the static one (with the patch I propose). If another dependency (B in your example) transitively depends on A-shared, that's compatible (the environment resolves, and since the dependency doesn't need to be rebuilt the CMake metadata for the shared libs isn't necessary). If another dependency transitively depends on the A-static, then that doesn't percolate further. The linked thread might make it sound contentious because it's a tricky subject and I didn't understand all the intricacies, but I'm on board with it now - it's the best we can do under a bunch of conflicting constraints. |
What I have in mind is that if you end up installing both A-static and A-shared in your build env, you can have only one |
As soon as you have both, static wins (which is the point of the |
Because static libraries don't self-propagate in terms of requirements, the only way to get into that "confusing situation" in the first place is if a given recipe explicitly demands the static variant, so that matches the intent quite well (the only blemish being the clobberwarning) |
Yes, I missed that. Thank you for clarification. |
- addresses conda-forge#164 - makes sure that libprotobuf-static bundles proper cmake files (one for static flavor, not dynamic one) Signed-off-by: Janusz Lisiecki <[email protected]>
Solution to issue cannot be found in the documentation.
Issue
It seems that libprotobuf-static depends on libprotobuf and the cmake configuration files it provides. So when one does:
(lowercase
protobuf
makes cmake using the cmake configuration files installed by protobuf, not build-in cmakeFindProtobuf
)it will be linked with the dynamic one even if the static is installed. Manually providing
libprotobuf.a
only partially solves the problem as it doesn't carry the dependency onlibutf8_validity.a
, whichlibprotobuf.a
requires to link successfully.I think that this test links dynamic libprotobuf, not a static one so it doesn't test
libprotobuf-static
.I'm looking to hear your opinion.
Installed packages
Environment info
The text was updated successfully, but these errors were encountered: