Installing HDF5
Procedure
- Use PuTTY to log in to the server as the root user.
- Set the environment variables.
export optflags="-O3" export ldflags="-Wl,--build-id"
- Create an installation directory.
mkdir -p /path/to/hdf5
- Go to the installation directory.
cd /path/to/hdf5
- Obtain the source code.
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.12/src/hdf5-1.8.12.tar.gz
- Decompress the HDF5 installation package.
tar -zxvf hdf5-1.8.12.tar.gz
- Go to the directory generated after the decompression.
cd hdf5-1.8.12
- Perform the configuration.
./configure --prefix=/path/to/hdf5 --build=aarch64-unknown-linux-gnu --enable-shared --enable-static=yes --enable-fortran CC=clang CXX=clang++ FC=flang F77=flang CFLAGS="$optflags -fPIC -Wno-incompatible-pointer-types-discards-qualifiers -Wno-non-literal-null-conversion" FCFLAGS="$optflags -fPIC" FFLAGS="$optflags -fPIC" LDFLAGS="$ldflags"

- Create a libtool.patch file.
- Create a libtool.patch file.
vi libtool.patch
- 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=""
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Create a libtool.patch file.
- Install the patch.
patch -p1 < libtool.patch

- Perform the compilation and installation.
make -j 8

make install

- Set the environment variables.
export PATH=/path/to/hdf5/bin:$PATH export LD_LIBRARY_PATH=/path/to/hdf5/lib:$LD_LIBRARY_PATH
Parent topic: Configuring the Compilation Environment