Building HDF5 1.10.1 with CMake on a Cray XC40 -> ../../bin/libhdf5.so, needed by libhdf5_hl.so, not found

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Building HDF5 1.10.1 with CMake on a Cray XC40 -> ../../bin/libhdf5.so, needed by libhdf5_hl.so, not found

Helge Knoop
Dear HDF-Forum,

I experience a linking problem using HDF5 after I build it from source. I used the git branch "hdf5_1_10_1".
The libhdf5_hl.so file seem to be hard linked to a non-existing ../../bin/libhdf5.so

the first hint to the problem was during the build of HDF5 already. I got this warning:
/usr/bin/ld: warning: ../../bin/libhdf5.so, needed by ../../../bin/libhdf5_tools.so, not found (try using -rpath or -rpath-link)
And other similar warnings.

and also while building my own program that uses HDF5, I got the warning again:
/usr/bin/ld: warning: ../../bin/libhdf5.so, needed by /home/h/nikknoop/opt/hdf5/lib/libhdf5_hl.so, not found (try using -rpath or -rpath-link)
and at runtime my own program crashed, after the warning not surprising, with:
./executable: error while loading shared libraries: ../../bin/libhdf5.so: cannot open shared object file: No such file or directory

A quick ldd of the actual /home/h/nikknoop/opt/hdf5/lib/libhdf5_hl.so returns:
$ ldd libhdf5_hl.so
        linux-vdso.so.1 =>  (0x00002aaaaaaab000)
        ../../bin/libhdf5.so => not found
        libm.so.6 => /lib64/libm.so.6 (0x00002aaaaad50000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00002aaaaafc9000)
        librt.so.1 => /lib64/librt.so.1 (0x00002aaaab1cd000)
        /home/h/nikknoop/opt/zlib/lib/libz.so (0x00002aaaab3d7000)
        /home/h/nikknoop/opt/szip/lib/libszip.so (0x00002aaaab5f1000)
        librca.so.0 => /opt/cray/rca/default/lib64/librca.so.0 (0x00002aaaab808000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aaaaba0d000)
        libc.so.6 => /lib64/libc.so.6 (0x00002aaaabc2a000)
        /lib64/ld-linux-x86-64.so.2 (0x0000555555554000)

and an objdump of the library returns:
$ objdump -x libhdf5_hl.so  | grep libhdf5.so
   NEEDED               ../../bin/libhdf5.so
$ objdump -x libhdf5_hl.so  | grep RPATH
  RPATH                /opt/cray/gcc-libs

I wondered why the heck libhdf5.so is searched for in "../../bin/libhdf5.so" instead of "<install_prefix>/lib/libhdf5.so" where it actually is installed?

I found in the HDF5 CMake build log the following line:
[ 72%] Linking C shared library ../bin/libhdf5.so
That looks familiar, but I would expect cmake to rewrite the linking during installation.

So could it be that CMake failed to care for correct linking at install time. After all, all the other links are correct:

$ objdump -x libhdf5.so  | grep NEEDED
  NEEDED               libm.so.6
  NEEDED               libdl.so.2
  NEEDED               librt.so.1
  NEEDED               /home/h/nikknoop/opt/zlib/lib/libz.so
  NEEDED               /home/h/nikknoop/opt/szip/lib/libszip.so
  NEEDED               librca.so.0
  NEEDED               libmpich_gnu_51.so.3
  NEEDED               libpthread.so.0
  NEEDED               libc.so.6

$ objdump -x libhdf5.so  | grep RPATH
  RPATH                /opt/cray/gcc-libs

I used the following cmake commands to configure and build hdf5:

$ cmake \
      -C "${source_dir}/config/cmake/cacheinit.cmake" \
      -DCMAKE_INSTALL_PREFIX:PATH=/home/h/nikknoop/opt/hdf5 \
      -DCMAKE_FIND_ROOT_PATH:PATH=/home/h/nikknoop/opt/szip \
      -DCMAKE_BUILD_TYPE:STRING="Release" \
      -DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment \
      -DTEST_LFS_WORKS_RUN=:STRING="0" \
      -DTEST_LFS_WORKS_RUN__TRYRUN_OUTPUT=:STRING="0" \
      -DH5_PRINTF_LL_TEST_RUN=:STRING="1" \
      -DH5_PRINTF_LL_TEST_RUN__TRYRUN_OUTPUT=:STRING="0" \
      -DH5_LDOUBLE_TO_LONG_SPECIAL_RUN=:STRING="1" \
      -DH5_LDOUBLE_TO_LONG_SPECIAL_RUN__TRYRUN_OUTPUT=:STRING="0" \
      -DH5_LONG_TO_LDOUBLE_SPECIAL_RUN=:STRING="1" \
      -DH5_LONG_TO_LDOUBLE_SPECIAL_RUN__TRYRUN_OUTPUT=:STRING="0" \
      -DH5_LDOUBLE_TO_LLONG_ACCURATE_RUN=:STRING="1" \
      -DH5_LDOUBLE_TO_LLONG_ACCURATE_RUN__TRYRUN_OUTPUT=:STRING="0" \
      -DH5_LLONG_TO_LDOUBLE_CORRECT_RUN=:STRING="1" \
      -DH5_LLONG_TO_LDOUBLE_CORRECT_RUN__TRYRUN_OUTPUT=:STRING="0" \
      -DH5_NO_ALIGNMENT_RESTRICTIONS_RUN=:STRING="1" \
      -DH5_NO_ALIGNMENT_RESTRICTIONS_RUN__TRYRUN_OUTPUT=:STRING="0" \
      -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
      -G "Unix Makefiles" \
      -DCMAKE_C_COMPILER=cc \
      -DCMAKE_CXX_COMPILER=CC \
      -DHDF5_BUILD_FORTRAN:BOOL=OFF \
      -DHDF5_BUILD_CPP_LIB:BOOL=OFF \
      -DHDF5_BUILD_JAVA:BOOL=OFF \
      -DBUILD_SHARED_LIBS:BOOL=ON \
      -DHDF5_ENABLE_PARALLEL:BOOL=ON \
      -DCMAKE_SKIP_RPATH:BOOL=OFF \
      -DCMAKE_SKIP_BUILD_RPATH:BOOL=OFF \
      -DCMAKE_SKIP_INSTALL_RPATH:BOOL=OFF \
      -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
      -DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON \
      -DCMAKE_INSTALL_RPATH:STRING="/home/h/nikknoop/opt/hdf5/lib" \
      -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON \
      -DSZIP_INCLUDE_DIR:PATH=/home/h/nikknoop/opt/szip/include \
      -DSZIP_LIBRARY:FILEPATH=/home/h/nikknoop/opt/szip/lib/libszip.so \
      -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON \
      -DZLIB_ROOT:PATH=/home/h/nikknoop/opt/zlib \
      -DMPIEXEC_MAX_NUMPROCS:STRING=4 \
      -DMPIEXEC_NUMPROC_FLAG:STRING=-n \
      -DMPIEXEC:STRING=mpirun \
      -Wno-dev \
      ${source_dir}

$ cmake --build ${build_dir} --target install -- -j4

Attached to this mail please find the complete cmake configure and build logs and the  CMakeCache.txt

I am using CMake version 3.9.0.

Can anyone help me solve this problem please? Preferably, I would like to have the rpath set the correct way withing the library file itself. I would prefer not to use LD_LIBRARY_PATH.
Please tell me if you need more information!

Best regard and thank you in advance for your help,
Helge
-- 
----------------------------------------------------------------------
M.Sc. Helge Knoop
Leibniz Universität Hannover
Institut fuer Meteorologie und Klimatologie
Herrenhaeuser Str. 2
30419 Hannover
Tel. +49 511 762 19238
[hidden email]
---------------------------------------------------------------------- 

_______________________________________________
Hdf-forum is for HDF software users discussion.
[hidden email]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

CMakeCache.txt (80K) Download Attachment
stdout_cmake_build.txt (1M) Download Attachment
stdout_cmake_configure.txt (19K) Download Attachment