- 执行以下命令下载安装包。
cd /path/to
wget https://codeload.github.com/Unidata/netcdf-fortran/tar.gz/refs/tags/v4.4.5 -O netcdf-fortran-4.4.5.tar.gz
wget https://codeload.github.com/Unidata/netcdf-c/tar.gz/refs/tags/v4.7.0 -O netcdf-c-4.7.0.tar.gz
tar xf netcdf-fortran-4.4.5.tar.gz
tar xf netcdf-c-4.7.0.tar.gz
- 执行以下命令进入netcdf-c源码目录并安装。
export HDF5_DIR=/path/to/hdf5
export PNETCDF_DIR=/path/to/pnetcdf
cd netcdf-c-4.7.0
CC=mpicc ./configure --prefix=/path/to/netcdf --build=aarch64-unknown-linux-gnu --enable-shared --enable-netcdf-4 --enable-dap --with-pic --disable-doxygen --enable-static --enable-pnetcdf --enable-largefile CPPFLAGS="-I${HDF5_DIR}/include -I${PNETCDF_DIR}/include" LDFLAGS="-L${HDF5_DIR}/lib -L${PNETCDF_DIR}/lib -Wl,-rpath=${HDF5_DIR}/lib -Wl,-rpath=${PNETCDF_DIR}/lib" CFLAGS="-L${HDF5_DIR}/lib -L${PNETCDF_DIR}/lib -I${HDF5_DIR}/include -I${PNETCDF_DIR}/include"
make -j 64
make install
- 执行以下命令进入netcdf-fortran源码目录并安装。
export NETCDF=/path/to/netcdf
export PATH=/path/to/netcdf/bin:$PATH
export LD_LIBRARY_PATH=/path/to/netcdf/lib:$LD_LIBRARY_PATH
cd ../netcdf-fortran-4.4.5
CC=mpicc FC=mpif90 F77=mpif90 ./configure --prefix=${NETCDF} --build=aarch64-unknown-linux-gnu --enable-shared --with-pic --disable-doxygen --enable-largefile --enable-static CPPFLAGS="-I${HDF5_DIR}/include -I${NETCDF}/include" LDFLAGS="-L${HDF5_DIR}/lib -L${NETCDF}/lib -Wl,-rpath=${HDF5_DIR}/lib -Wl,-rpath=${NETCDF}/lib" CFLAGS="-L${HDF5_DIR}/lib -L${NETCDF}/lib -I${HDF5_DIR}/include -I${NETCDF}/include" CXXFLAGS="-L${HDF5_DIR}/lib -L${NETCDF}/lib -I${HDF5_DIR}/include -I${NETCDF}/include" FCFLAGS="-L${HDF5_DIR}/lib -L${NETCDF}/lib -I${HDF5_DIR}/include -I${NETCDF}/include"
make -j 64
make install
- 执行以下命令设置环境变量。
export INCLUDE=/path/to/netcdf/include:$INCLUDE