下载地址:https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.5.2.tar.gz
cd /path/to/download/netcdf-fortran
tar -zxvf netcdf-fortran-4.5.2.tar.gz
cd netcdf-fortran-4.5.2
./configure --prefix=/path/to/install/NETCDF --build=aarch64-unknown-linux-gnu --enable-shared --with-pic --disable-doxygen --enable-largefile --enable-static CC=mpicc CXX=mpicxx FC=mpifort F77=mpifort CPPFLAGS=" -fPIC -I/path/to/install/HDF5/include -I/path/to/install/NETCDF/include" LDFLAGS="-L/path/to/install/HDF5/lib -L/path/to/install/NETCDF/lib -Wl,-rpath=/path/to/install/HDF5/lib -Wl,-rpath=/path/to/install/NETCDF/lib" CFLAGS=" -fPIC -L/path/to/install/HDF5/lib -L/path/to/install/NETCDF/lib -I/path/to/install/HDF5/include -I/path/to/install/NETCDF/include" CXXFLAGS=" -fPIC -L/path/to/install/HDF5/lib -L/path/to/install/NETCDF/lib -I/path/to/install/HDF5/include -I/path/to/install/NETCDF/include" FCFLAGS=" -fPIC -L/path/to/install/HDF5/lib -L/path/to/install/NETCDF/lib -I/path/to/install/HDF5/include -I/path/to/install/NETCDF/include"
vi libtool
第11787行 wl="" 修改为 wl="-Wl,"
第11939行 wl="" 修改为 wl="-Wl,"
各版本NETCDF-FORTRAN所在行可能不同,可以查找wl=””进行修改。
make make install