I am trying to compile ROMS on Linux sever with pgi. The error message I got is like this:
'''
ROMS/Utility/checkdefs.F
ar: creating /home/ywang/roms/Projects/Upwelling/Build/libUTIL.a
ar: creating /home/ywang/roms/Projects/Upwelling/Build/libNLM.a
ar: creating /home/ywang/roms/Projects/Upwelling/Build/libNLM_bio.a
ar: creating /home/ywang/roms/Projects/Upwelling/Build/libNLM_sed.a
ar: creating /home/ywang/roms/Projects/Upwelling/Build/libANA.a
ar: creating /home/ywang/roms/Projects/Upwelling/Build/libMODS.a
/usr/bin/ld: cannot find -lnetcdff
make: *** [/home/ywang/roms/Projects/Upwelling/oceanG] Error 2
'''
I have set the LD_LIBRARY_PATH to the netcdf lib folder where I have the file libnetcdff.a. Also in the build.bash, I set USE_NETCDF=on open to let the "nf-config --flibs" work.
The output of 'nf-config --flibs' is:
'''
-L/proj/pgi/linux86-64/2016/netcdf/netcdf-fortran-4.4.2/lib -lnetcdff -O -tp p7 \
-L/proj/pgi/linux86-64/2016/netcdf/netcdf-4.3.3.1/lib -R/proj/pgi/linux86-64/2016/netcdf/netcdf-4.3.3.1/lib -lnetcdf -lnetcdf
'''
When I type ld -lnetcdff --verbose, I got message:
'''
attempt to open /usr/x86_64-redhat-linux/lib64/libnetcdff.so failed
attempt to open /usr/x86_64-redhat-linux/lib64/libnetcdff.a failed
attempt to open /usr/local/lib64/libnetcdff.so failed
attempt to open /usr/local/lib64/libnetcdff.a failed
attempt to open /lib64/libnetcdff.so failed
attempt to open /lib64/libnetcdff.a failed
attempt to open /usr/lib64/libnetcdff.so failed
attempt to open /usr/lib64/libnetcdff.a failed
attempt to open /usr/x86_64-redhat-linux/lib/libnetcdff.so failed
attempt to open /usr/x86_64-redhat-linux/lib/libnetcdff.a failed
attempt to open /usr/lib64/libnetcdff.so failed
attempt to open /usr/lib64/libnetcdff.a failed
attempt to open /usr/local/lib/libnetcdff.so failed
attempt to open /usr/local/lib/libnetcdff.a failed
attempt to open /lib/libnetcdff.so failed
attempt to open /lib/libnetcdff.a failed
attempt to open /usr/lib/libnetcdff.so failed
attempt to open /usr/lib/libnetcdff.a failed
ld: cannot find -lnetcdff
'''
It seems ld tried to search -lnetcdff through some default folder, instead of what I set up through LD_LIBRARY_PATH or nf-config --flibs.
It would be appreciated to have your advice!
Best regards
Yifan