Closed bxwllzz closed 7 years ago
Hmm, I guess it needs a slightly more clever fix, because its really not clear if HDF5 was built
with szip support or not? One solution is of course pkg-config
that was meant exactly for this
kind of problem. An alternative might be to try without szip and add -ldl -lszip
as a fallback if
linking fails without it?
Just my two cents...
I regularly build HDF5 from source and test it on Travis CI and never met the issue. Can you please provide yout HDF5 config (call).
@tbeu are you building hdf5 against the (optional) szip library?
No, I don't since it is not needed (by matio to have the szip support for hdf5).
This is the reason. I think many people build hdf5 with szip because its one of the "official"
filters. Maybe even the official Windows dll is linked against szip?
In any case, I would not add -ldl -lszip
as a default, but it might be good to have a way to
add it for users who need it. @bxwllzz did you try adding it to LD_LIBS
or LD_FLAGS
when running configure?
OK, I will check it if I configure hdf5 with --with-szlib
.
I build HDF5 with cmake as HDF5 - Building HDF5-1.8 With CMake which is "RECOMMENDED by HDF5". Following the Build Instructions
in that page, I run build-unix.sh
to built HDF5.
I just noticed it says
These files will build the static HDF5 C and C++ libraries with SZIP and ZLIB compression included.
But I stiil don't know how to use cmake to build HDF5 without SZIP?
@emmenlau Adding -ldl -lszip
to LD_LIBS
or LD_FLAGS
when running configure didn't solve this problem.
@bxwllzz I did not test this myself but here are cmake instructions from HDF5:
https://support.hdfgroup.org/HDF5/release/chgcmkbuild.html
According to my understanding -DHDF5_ENABLE_SZIP_SUPPORT=OFF
should disable
SZIP. If you want to be double sure, add also -DHDF5_ENABLE_SZIP_ENCODING=OFF
.
I did not test it, but it seems promising. Does it help?
@emmenlau build-unix.sh
run ctest -S HDF5config.cmake,BUILD_GENERATOR=Unix -C Release -V -O hdf5.log
In HDF5config.cmake
, I found some options:
...
### disable ext libs building
#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF")
#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF")
#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF")
...
After uncomment these lines, I can make HDF5 without SZIP. Thanks for your advice.
It is all working for me - using plain configure and not cmake.
curl https://support.hdfgroup.org/ftp/lib-external/szip/2.1.1/src/szip-2.1.1.tar.gz -O -J
tar -zxf szip-2.1.1.tar.gz
cd szip-2.1.1
./configure --quiet CFLAGS="-w"
make install -C src
cd ..
git clone --depth 1 --branch hdf5_1_8_18 https://bitbucket.hdfgroup.org/scm/hdffv/hdf5.git hdf5_1_8_18
cd hdf5_1_8_18
./configure --quiet --enable-shared --disable-production --enable-debug=all --with-pic --disable-deprecated-symbols --disable-hl --disable-strict-format-checks --disable-clear-file-buffers --disable-instrument --disable-parallel --disable-trace --with-default-api-version=v18 --with-szlib=~/szip-2.1.1/szip CFLAGS="-w"
make install -C src
You can run cmake -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF ./
to disable szlib in hdf5.
HDF5 is built from source. When configure matio, it reported can't found HDF5:
config.log:
Fix is change HDF5_LIBS in matio_hdf5.m4 From "-L${HDF5_DIR}/lib -lhdf5" To "-L${HDF5_DIR}/lib -lhdf5 -ldl -lszip"