netcdf4.2以上的版本c库和fortran库分开,要先安装netcdf-c,然后再安装netcdf-fortran
netcdf-c容易顺利安装,在安装netcdf-fortran 出现如下报错
checking size of off_t... configure: error: in `/home/u0017592/projects/netcdf-fortran':
configure: error: cannot compute sizeof (off_t)
See `config.log' for more details
查看日志为:
./conftest: error while loading shared libraries: libnetcdf.so.11: cannot open shared object file: No such file or directory
该错误是 :libnetcdf.so.11 文件不在 LD_LIBRARY_PATH 中,因为测试程序编译正常,只是在运行时出现故障。需要更新 LD_LIBRARY_PATH,以反映 netCDF-C 库的位置,然后重新运行 configure
先
vi ~/.bashrc
然后 写入 LD_LIBRARY_PATH(得根据自己的路径进行替换)
export LD_LIBRARY_PATH=/work/home/ac1agy0832/model/RegCM4_7/local/netcdf/lib:$LD_LIBRARY_PATH
然后保存退出
执行
source ~/.bashrc
再进行安装即可