I am working on building hdf5-2.0.0 on a rhel8 system. It currently has zlib-1.2.11 installed. Reading through the instructions in the INSTALL_Cmake.txt file, specifically:
- If you plan to use Zlib or Szip (aka libaec):
A. Download the binary packages and install them in a central location.
For example on Windows, create a folder extlibs and install the
packages there. Add the following CMake options:
-DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib
-DZLIB_INCLUDE_DIR:PATH=some_location/include
-DZLIB_USE_EXTERNAL:BOOL=OFF
-DSZIP_LIBRARY:FILEPATH=some_location/lib/libszaec.lib
-DSZIP_INCLUDE_DIR:PATH=some_location/include
-Dlibaec_LIBRARY:FILEPATH=some_location/lib/libaec.lib
-Dlibaec_INCLUDE_DIR:PATH=some_location/include
-DSZIP_USE_EXTERNAL:BOOL=OFF
where âsome_locationâ is the full path to the extlibs folder.
Also if the appropriate environment variable is set, the above options are not required;
set(ENV{ZLIB_ROOT} âsome_locationâ)
set(ENV{SZIP_ROOT} âsome_locationâ)
set(ENV{libaec_ROOT} âsome_locationâ)
I am under the impression that with zlib already installed on my rhel8 system, I can use that in place of downloading it again. Unfortunately that does not appear to be the case. Below is the cmake command I am using.
cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON -DHDF5_ENABLE_ZLIB_SUPPORT:BOOL=ON -DZLIB_USE_EXTERNAL:BOOL=OFF -DZLIB_USE_LOCALCONTENT:BOOL=ON -DZLIB_LIBRARY:FILEPATH=/usr/lib64/libz.so -DZLIB_INCLUDE_DIR:PATH=/usr/include -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DLIBAEC_TGZ_NAME:STRING=libaec-1.1.3.tar.gz -DLIBAEC_TGZ_ORIGPATH:STRING=%{_hdf5_build_loc}/libaec/ -DLIBAEC_USE_LOCALCONTENT:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=ON ../hdf5-2.0.0
This will build without error on my system. It will however state that it did not use the ZLIB_LIBRARY and ZLIB_INCLUDE_DIR. Upon installing this and attempting to use it, I find I am unable to read h5 files with deflate compression:
GROUP âRH::SFC::20250912_1500â20250912_1600â {
DATASET âDataâ {
DATATYPE H5T_STD_I8LE
DATASPACE SIMPLE { ( 289, 417 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
DATA {h5dump error: unable to print data} }}
I have also written a small python program with h5py to test gzip compression, and it too fails when reading or writing a gzip compressed file.
This can be solved if instead of relying on the system installed zlib, I download and include the .tar.gz file much like libaec. I have the following questions on this issue:
- Why I am receiving no errors when this is building, yet zlib support does not seem to be built in or included.
- If I am specifying a local libaec to be built, does this in turn require zlib to be built in the same manner?
