安装NETCDF-Fortran

操作步骤

  1. 使用PuTTY工具,以root用户登录服务器。
  2. 执行以下命令,进入安装NETCDF-Fortran创建的NETCDF-C安装目录。

    cd /path/to/NETCDF

  3. 执行以下命令获取NETCDF-Fortran安装包。

    wget https://codeload.github.com/Unidata/netcdf-fortran/tar.gz/refs/tags/v4.5.2 --no-check-certificate

  4. 执行以下命令重命名并解压NETCDF-Fortran安装包。

    mv v4.5.2 netcdf-fortran-4.5.2.tar.gz
    tar -zxvf netcdf-fortran-4.5.2.tar.gz

  5. 执行以下命令进入解压后的目录。

    cd netcdf-fortran-4.5.2

  6. 执行以下命令进行配置。

    ./configure --prefix=/path/to/NETCDF --build=aarch64-unknown-linux-gnu --enable-shared --with-pic --disable-doxygen --enable-largefile --enable-static CC=gcc CXX=g++ FC=gfortran F77=gfortran CPPFLAGS="-I/path/to/HDF5/include -I/path/to/NETCDF/include" LDFLAGS="-L/path/to/HDF5/lib -L/path/to/NETCDF/lib -Wl,-rpath=/path/to/HDF5/lib -Wl,-rpath=/path/to/NETCDF/lib"CFLAGS="-L/path/to/HDF5/lib -L/path/to/NETCDF/lib -I/path/to/HDF5/include -I/path/to/NETCDF/include" CXXFLAGS="-L/path/to/HDF5/lib -L/path/to/NETCDF/lib -I/path/to/HDF5/include -I/path/to/NETCDF/include" FCFLAGS="-L/path/to/HDF5/lib -L/path/to/NETCDF/lib -I/path/to/HDF5/include -I/path/to/NETCDF/include"

  7. 执行以下命令进行编译安装。

    make -j

    make install

  8. 执行以下命令验证是否安装成功。

    ls /path/to/NETCDF/bin
    ls /path/to/NETCDF/lib

    回显信息显示如下内容,表示安装成功。