Installing NetCDF-Fortran
Procedure
- Use PuTTY to log in to the server as the root user.
- Decompress the NetCDF-Fortran installation package.
tar -zxvf netcdf-fortran-4.4.5.tar.gz
- Go to the directory generated after the decompression.
cd netcdf-fortran-4.4.5
- Perform the configuration.
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

- Apply the patch package.
patch -p1 < libtool.patch

- Create a libtool.patch file and edit the file.
- Create a libtool.patch file.
vi libtool.patch
- Press i to enter the edit mode and add the following content:
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=""
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Create a libtool.patch file.
- Perform the installation.
make -j$threads

make install

- Verify the installation.
ls /path/to/NETCDF/bin ls /path/to/NETCDF/lib

Parent topic: Configuring the Compilation Environment