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 -p1 < libtool.patch
vi libtool.patch
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=""
make -j$threads
make install
ls /path/to/NETCDF/bin ls /path/to/NETCDF/lib