mkdir -p /path/to/hdf4
cd /path/to/hdf4
wget https://support.hdfgroup.org/ftp/HDF/releases/HDF4.2.15/src/hdf-4.2.15.tar.gz
tar -zxvf hdf-4.2.15.tar.gz
cd hdf-4.2.15
sed -i '974c #if defined(__linux__) && defined __x86_64__ && !( defined SUN) || defined(__aarch64__)' hdf/src/hdfi.h sed -i '23660a LIBS="$LIBS -L/usr/lib64 -ltirpc"' configure sed -i '23662c CPPFLAGS="$SYSCPPFLAGS -I/usr/include/tirpc"' configure
需要依赖libtirpc-devel,请在部署前确保安装完成。此外,请在修改时添加libtirpc的实际路径,这里默认安装到/usr/include、/usr/lib64。
export CC=mpicc CXX=mpicxx FC=mpifort F77=mpifort export LIBJPEG_PATH=/path/to/libjpeg ./configure --prefix=/path/to/hdf4 --enable-production --with-zlib=/usr/lib64 --enable-fortran --enable-hdf4-xdr --disable-shared --build=arm-linux --with-jpeg=${LIBJPEG_PATH} --disable-netcdf CFLAGS="-fPIC -Wno-error=int-conversion" CXXFLAGS="-fPIC -Wno-error=int-conversion" FFLAGS="-fPIC -Wno-error=int-conversion -fallow-argument-mismatch" LDFALGS="-L/usr/lib64 -ltirpc"
make -j 32 make install
export PATH=/path/to/hdf4/bin:$PATH export LD_LIBRARY_PATH=/path/to/hdf4/lib:$LD_LIBRARY_PATH export INCLUDE=/path/to/hdf4/include:$INCLUDE