Now I am learning ROMS according to Professor Lorenzo's videos with his old code (ROMS of version 3.0). However, I met some problems when compiling the code with command "gmake". While the first time I used the command, the error message was as below:
-------------------------------------------------------------------------
/usr/bin/cpp -P -traditional -I/drive/edl/netcdf-3.6.0-p1/include -DLINUX -DX86_64 -DPGI -IInclude -IAdjoint -INonlinear -IRepresenter -ITangent -IDrivers -ISeaIce Modules/mod_kinds.F > mod_kinds.f90
Bin/cpp_clean mod_kinds.f90
pgf90 -c -u -Bstatic -fastsse -Mipa=fast mod_kinds.f90
pgf90-Error-Switch -u expects an argument
-u<undef> Passed to linker; generate undefined reference
gmake: *** [mod_kinds.o] Error 1
rm mod_kinds.f90
------------------------------------------------------------------------------------------------
Then I turned on the MPI and MPIF90, and unexpectedly I found it could run because in fact my computer failed to install MPI but with error message as below:
------------------------------------------------------------------------------------------------
/usr/bin/cpp -P -traditional -I/drive/edl/netcdf-3.6.0-p1/include -DMPI -DLINUX -DX86_64 -DPGI -IInclude -IAdjoint -INonlinear -IRepresenter -ITangent -IDrivers -ISeaIce Drivers/propagator.F > propagator.f90
mpif90 -c -u -Bstatic -fastsse -Mipa=fast mod_kinds.f90
gmake: mpif90: Command not found
Bin/cpp_clean master.f90
Bin/cpp_clean ocean_control.f90
gmake: *** [mod_kinds.o] Error 127
gmake: *** Waiting for unfinished jobs....
Bin/cpp_clean propagator.f90
rm seaice.f90 mod_kinds.f90
------------------------------------------------------------------------------------------------
Due to the failed MPI installation, this error could be understood so I turned off the MPI option. Then I corrected a error in the file “cppdefs.h” and this time the compiling moved forward a step but it still did failed with error message as follows:
------------------------------------------------------------------------------------------------
/usr/bin/cpp -P -traditional -I/drive/edl/netcdf-3.6.0-p1/include -DLINUX -DX86_64 -DPGI -IInclude -IAdjoint -INonlinear -IRepresenter -ITangent -IDrivers -ISeaIce Nonlinear/analytical.F > analytical.f90
Bin/cpp_clean analytical.f90
pgf90 -c -g analytical.f90
PGF90-S-0034-Syntax error at or near : (analytical.f90: 1100)
PGF90-S-0034-Syntax error at or near : (analytical.f90: 1109)
0 inform, 0 warnings, 2 severes, 0 fatal for ana_vmix_tile
gmake: *** [analytical.o] Error 2
rm mod_kinds.f90
------------------------------------------------------------------------------------------------
After I modified the file “analytical.f90”, the syntax error was corrected but with another error message as follows:
------------------------------------------------------------------------------------------------
/usr/bin/cpp -P -traditional -I/drive/edl/netcdf-3.6.0-p1/include -DLINUX -DX86_64 -DPGI -IInclude -IAdjoint -INonlinear -IRepresenter -ITangent -IDrivers -ISeaIce Drivers/propagator.F > propagator.f90
Bin/cpp_clean propagator.f90
pgf90 -c -g propagator.f90
pgf90 -c -g ocean_control.f90
pgf90 -c -g master.f90
pgf90 -g master.o ocean_control.o propagator.o -o oceanS libADM.a libRPM.a libTLM.a libNLM.a libICE.a libUTIL.a libMODS.a -L/drive/edl/netcdf-3.6.0-p1/lib -lnetcdf
/usr/bin/ld: cannot find -lnetcdf
gmake: *** [oceanS] Error 2
rm seaice.f90
------------------------------------------------------------------------------------------------
This time I did not know how to solve it.
After a while I saw the same problem in another place when executing the compile file. The error message was as below:
------------------------------------------------------------------------------------------------
/usr/bin/cpp -P -traditional -I/drive/edl/netcdf-3.6.0-p1/include -DLINUX -DX86_64 -DPGI -IInclude -IAdjoint -INonlinear -IRepresenter -ITangent -IDrivers -ISeaIce Drivers/propagator.F > propagator.f90
Bin/cpp_clean propagator.f90
pgf90 -c -g propagator.f90
pgf90 -c -g ocean_control.f90
pgf90 -c -g master.f90
pgf90 -g master.o ocean_control.o propagator.o -o oceanS libADM.a libRPM.a libTLM.a libNLM.a libICE.a libUTIL.a libMODS.a -L/drive/edl/netcdf-3.6.0-p1/lib -lnetcdf
/usr/bin/ld: cannot find -lnetcdf
gmake: *** [oceanS] Error 2
rm seaice.f90 mod_kinds.f90
mv: cannot stat `oceanS': No such file or directory
------------------------------------------------------------------------------------------------
Does anyone know how to solve this problem? I appreciate you very much!
problems about "/usr/bin/ld: cannot find -lnetcdf"
Re: problems about "/usr/bin/ld: cannot find -lnetcdf"
Do you have the netcdf library installed? This says it should be in:pgf90 -g master.o ocean_control.o propagator.o -o oceanS libADM.a libRPM.a libTLM.a libNLM.a libICE.a libUTIL.a libMODS.a -L/drive/edl/netcdf-3.6.0-p1/lib -lnetcdf
/usr/bin/ld: cannot find -lnetcdf
/drive/edl/netcdf-3.6.0-p1/lib
That sounds suspiciously like someplace on Prof di Lorenzo's system with his initials edl. So, do you have it, and if so, where? If not, compile it yourself - it's free.
You can go into the file Compilers/Linux-pgi.mk and change the FFLAGS. If it doesn't like the "-u", take it out. I hope you aren't using roms 3.0 and that's why you're picking up outmoded flags.pgf90 -c -u -Bstatic -fastsse -Mipa=fast mod_kinds.f90
pgf90-Error-Switch -u expects an argument
-u<undef> Passed to linker; generate undefined reference