-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
CMake Updates for Superbuilds & find_package #1560
Comments
Mixing static and shared libraries is a bad idea... If parent project is built as shared library, all dependencies should also be built as shared libraries. This is because linkers take the first matching symbol they find and ignore any duplicate symbols found later in the command-line, possibly causing parts of binary to use different versions of same function, breaking any internally used "state" variables. I'm all for adding and exporting CMake alias targets as it has been discussed before, and I fully agree that it makes using zlib-ng as a dependency a lot easier. |
Thanks @mtl1979, sounds good! Yes, it's up to the user to uses statics and shared as they seem necessary. Generally I agree, either go all shared (especially in package managers) or all static (e.g., python wheels) and hide all symbols for encapsulation. Nonetheless, we can expose position independent code as an option, so people are free to mix as they need it. Note that if a static lib is fully "privately" (CMake PRIVATE) consumed into an intermediate share lib, there is no issue with that unless globals are used (what you mention with "state" variables). |
@ax3l That still shifts responsibility for trapping incompatible build parameters from zlib-ng to any project that links against it, which isn't something we should do. There is already past discussions about how we handle mixing zlib and zlib-ng in same project, requiring zlib-ng to be built without zlib compatibility enabled, thus prefixing every function and variable that might be visible during either static or shared builds. |
FWIW, we have already merged Blosc/c-blosc2#544, as it was giving us the possibility to use latest versions of zlib-ng from Blosc2 (with the bonus that, as cmake is running entirely inside zlib-ng, the library seems much better optimized now). However, after doing that, I noticed that |
After some attempts on my side, I don't think the zlib-ng project can do anything to fix that, because it looks like it is C-Blosc2 that is including |
I continue to try to make this work, and it looks like With
With
So, it looks like the zlib-ng include files (zlib.h, zlib_name_mangling.h and zconf.h) are avoided in the c-blosc2 package. However, I tried to make the linking with zlib-ng PRIVATE:
Everything compiles and runs just fine, but |
You can't avoid bundling |
Hi,
Thank you for zlib-ng!
I was working with @FrancescAlted on C-Blosc2 the other week to modernize our large dependency build chain.
In #1557, we noticed a few CMake updates that we could incorporate to zlib-ng would make superbuilds easier and could simplify usage of zlib-ng as drop-in replacement in existing CMake builds that use zlib.
I have the following updates in mind:
FindZLIBNG.cmake
files anymore (e.g., CMake: Update FindZLIB_NG For Target Blosc/c-blosc2#541) and can preserve the CMake targets and their propertiesWould you be interested if I took the time and submit PRs for this? :)
The text was updated successfully, but these errors were encountered: