安装NETCDF-Fortran
操作步骤
- 使用PuTTY工具,以root用户登录服务器。
- 执行以下命令解压NETCDF-Fortran安装包。
tar -zxvf netcdf-fortran-4.4.5.tar.gz
- 执行以下命令进入解压后的目录。
cd netcdf-fortran-4.4.5
- 执行以下命令进行编译配置。
CC=mpicc CFLAGS="$optflags -I/path/to/HDF5/include -I/path/to/NETCDF/include" FC=mpif90 FFLAGS="$optflags -fPIC -I/path/to/HDF5/include -I/path/to/NETCDF/include" FCFLAGS="$optflags -fPIC -I/path/to/HDF5/include -I/path/to/NETCDF/include" F77=mpif77 LDFLAGS="$ldflags -L/opt/compiler/BS/bisheng-compiler-1.3.1-aarch64-linux -L/path/to/HDF5/lib -L/path/to/NETCDF/lib" ./configure --build=aarch64-linux --prefix=/path/to/NETCDF --enable-static --enable-shared --with-pic --enable-parallel-tests --enable-largefile --enable-large-file-tests
- 执行以下命令合入patch包。
patch -p1 < libtool.patch
- 新建并编辑“libtool.patch”文件。
- 新建“libtool.patch”文件。
vi libtool.patch
- 按“i”进入编辑模式,添加如下内容。
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=""
- 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。
- 新建“libtool.patch”文件。
- 执行以下命令进行编译安装。
make -j$threads
make install
- 执行以下命令验证是否安装成功。
ls /path/to/NETCDF/bin ls /path/to/NETCDF/lib
父主题: 配置编译环境