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
Issue linking to static lib hdf5 with szip support #324
Comments
Thanks for pointing this out; your suggestion is a good one, I'll see if it's that simple (feel free to try to beat me to the punch with a pull request!). In the meantime, you can use the |
To complement the issue, the same thing happens if HDF5 is built with zlib support, so the same kind of modification would need to be added for zlib |
Ok, while this error still makes sense on paper and will still be addressed, it is worth noting that I cannot replicate this issue. The cmake system as it stands does not throw an error when building as described in the original report. I'd like to figure out why; what version of cmake are you using? |
Ok, I'm having problems replicating this, and we fall into a chicken-and-the-egg issue; szip should only be checked for if the hdf5 library requires it, and we can't check if the hdf5 library requires it, when using static libraries, without specifying it. Given that I can't replicate this, I wonder how broad the scope of this issue is. What is your OS and cmake version? I'm able to get things to work by specifying |
I am using cmake 3.2.3 on windows. Indeed there is a issue with what to test first. SZIP should be tested only if hdf5 needs it, but hdf5 tests can not be built if we don't provide szip and it needs it. SZIP presence can still be tested without the need for HDF5. I would say that if USE_SZIP=ON (and USE_HDF5=ON), then it can be justified to test SZIP presence first without yet searching if we want to link to a HDF5 that needs it. Then if a SZIP is found, adding it to the link list during the duration of HDF5 tests should not hurt; it will just have no effect if HDF5 doesn't need it. In my personal case, i only need netcdf static library, and this seemed only to generate issues to me when building the tests packaged in netcdf. I disabled their build and i am not disturbed anymore, i just provide needed include paths and libraries on cmake command line (+ a sed in CMakeLists because my szip livbrary is libszip and not sz) Part of my build script :
|
If i try to build netcdf with a static version of hdf5 that has szip support, I get errors at
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5free_memory "" HDF5_HAS_H5FREE)
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY} H5Pset_libver_bounds "" HDF5_HAS_LIBVER_BOUNDS)
of CMakeLists.txt. Because szip symbols are not found at link time
Not far after that, there is the test of dependency of hdf5 to szip. Couldn't that test be put before the CHECK_LIBRARY_EXISTS, and in the IF(SZIP), adding something like CMAKE_REQUIRED_LIBRARIES += szip, so the tests that build hdf5 also link szip?
It might not be this trivial, as the SZIP tests too does a CHECK_LIBRARY_EXISTS, so this one might fail too.
The text was updated successfully, but these errors were encountered: