Skip to content
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

Error built with HDF5 1.8.18 #59

Closed
bxwllzz opened this issue Apr 20, 2017 · 11 comments
Closed

Error built with HDF5 1.8.18 #59

bxwllzz opened this issue Apr 20, 2017 · 11 comments

Comments

@bxwllzz
Copy link

bxwllzz commented Apr 20, 2017

HDF5 is built from source. When configure matio, it reported can't found HDF5:

./configure --enable-mat73=yes --with-hdf5=/home/pi/matio/CMake-hdf5-1.8.18/HDF5-1.8.18-Linux/HDF_Group/HDF5/1.8.18 --with-default-file-ver=7.3
...
checking for HDF5 software...  no
...   
MATIO Configuration Summary       
==============================================================
           C Compiler: gcc
               CFLAGS:  -g -O2
     Shared Libraries: yes
     Static Libraries: yes
  default MAT version: MAT_FT_MAT73

Features --------------------------------------------
  MAT v7.3 file support: no
Extended sparse support: yes

Packages --------------------------------------------
                 zlib: -lz
                 hdf5: 
               MATLAB: 

config.log:

...
configure:15844: checking for HDF5 software
configure:15881: gcc -o conftest -I/home/pi/matio/CMake-hdf5-1.8.18/HDF5-1.8.18-Linux/HDF_Group/HDF5/1.8.18/include  -g -O2   conftest.c -L/home/pi/matio/CMake-hdf5-1.8.18/HDF5-1.8.18-Linux/HDF_Group/HDF5/1.8.18/lib -lhdf5 -lz -lm  >&5
/home/pi/matio/CMake-hdf5-1.8.18/HDF5-1.8.18-Linux/HDF_Group/HDF5/1.8.18/lib/libhdf5.a(H5PL.c.o): In function `H5PL_term_interface':
H5PL.c:(.text+0x32c): undefined reference to `dlclose'
/home/pi/matio/CMake-hdf5-1.8.18/HDF5-1.8.18-Linux/HDF_Group/HDF5/1.8.18/lib/libhdf5.a(H5PL.c.o): In function `H5PL_load':
H5PL.c:(.text+0x5e8): undefined reference to `dlsym'
H5PL.c:(.text+0x7ac): undefined reference to `dlopen'
H5PL.c:(.text+0x7bc): undefined reference to `dlsym'
H5PL.c:(.text+0x934): undefined reference to `dlclose'
H5PL.c:(.text+0x99c): undefined reference to `dlerror'
H5PL.c:(.text+0xca4): undefined reference to `dlclose'
/home/pi/matio/CMake-hdf5-1.8.18/HDF5-1.8.18-Linux/HDF_Group/HDF5/1.8.18/lib/libhdf5.a(H5Z.c.o): In function `H5Z_init_interface':
H5Z.c:(.text+0x958): undefined reference to `SZ_encoder_enabled'
/home/pi/matio/CMake-hdf5-1.8.18/HDF5-1.8.18-Linux/HDF_Group/HDF5/1.8.18/lib/libhdf5.a(H5Zszip.c.o): In function `H5Z_filter_szip':
H5Zszip.c:(.text+0x104): undefined reference to `SZ_BufftoBuffDecompress'
H5Zszip.c:(.text+0x19c): undefined reference to `SZ_BufftoBuffCompress'
collect2: error: ld returned 1 exit status
...

Fix is
change HDF5_LIBS in matio_hdf5.m4
From "-L${HDF5_DIR}/lib -lhdf5"
To "-L${HDF5_DIR}/lib -lhdf5 -ldl -lszip"

@emmenlau
Copy link

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...

@tbeu
Copy link
Owner

tbeu commented Apr 20, 2017

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).

@emmenlau
Copy link

emmenlau commented Apr 20, 2017

@tbeu are you building hdf5 against the (optional) szip library?

@tbeu
Copy link
Owner

tbeu commented Apr 20, 2017

No, I don't since it is not needed (by matio to have the szip support for hdf5).

@emmenlau
Copy link

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 -lszipas 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?

@tbeu
Copy link
Owner

tbeu commented Apr 20, 2017

OK, I will check it if I configure hdf5 with --with-szlib.

@bxwllzz
Copy link
Author

bxwllzz commented Apr 20, 2017

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.

@emmenlau
Copy link

@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?

tbeu added a commit that referenced this issue Apr 20, 2017
@bxwllzz
Copy link
Author

bxwllzz commented Apr 20, 2017

@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.

@tbeu
Copy link
Owner

tbeu commented Apr 20, 2017

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

@tbeu
Copy link
Owner

tbeu commented Apr 20, 2017

You can run cmake -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF ./ to disable szlib in hdf5.

tbeu added a commit that referenced this issue Apr 20, 2017
@tbeu tbeu closed this as completed May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants