Rate This Document
Findability
Accuracy
Completeness
Readability

Installing HDF5

  • If the configure file in the source packages of the HDF5 components specifies that the GNU software optimization level is O3, add the following optimization options before performing 1. For details, see 4.
    export optflags="-O3"
    export ldflags="-Wl,--build-id"
    export threads=$(nproc)
  • If the configure file specifies that non-GNU software optimization is not required, you do not need to add optimization options.

Procedure

  1. Use PuTTY to log in to the server as the root user.
  2. Decompress the HDF5 installation package.
    tar -zxvf hdf5-1.10.5.tar.gz
  3. Go to the directory generated after the decompression.
    cd hdf5-1.10.5
  4. Perform the configuration.
    CC=mpicc CFLAGS="$optflags -fPIC -Wno-incompatible-pointer-types-discards-qualifiers -Wno-non-literal-null-conversion" FC=mpif90 FCFLAGS="$optflags -fPIC" FFLAGS="$optflags -fPIC" LDFLAGS="$ldflags" CXX=mpicxx ./configure --prefix=/path/to/HDF5 --enable-shared --enable-static --enable-fortran --enable-parallel --enable-optimization=high

  5. Apply the patch package.
    patch -p1 < libtool.patch

  6. Create a libtool.patch file and edit the file.
    1. Create a libtool.patch file.
      vi libtool.patch
    2. Press i to enter the insert mode and add the following content:
      diff -ruN hdf5-1.10.1/libtool hdf5-1.10.1-new/libtool
      --- hdf5-1.10.1/libtool 2019-12-02 20:02:56.270676503 +0000
      +++ hdf5-1.10.1-new/libtool 2019-12-02 20:03:05.062708034 +0000
      @@ -11832,7 +11832,7 @@
       pic_flag=""
       # How to pass a linker flag through the compiler.
      -wl=""
      +wl="-Wl,"
       # Compiler flag to prevent dynamic linking.
         link_static_flag=""
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  7. Perform the compilation and installation.
    make -j$threads

    make install

  8. Verify the installation.
    ls /path/to/HDF5/lib
    ls /path/to/HDF5/bin

    If the following information is displayed, the installation is successful:

  9. Load the environment variables.
    export PATH=/path/to/HDF5/bin:$PATH
    export LD_LIBRARY_PATH=/path/to/HDF5/lib:$LD_LIBRARY_PATH