compile ROMS error

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
Rachel

compile ROMS error

#1 Unread post by Rachel »

Dear all,
I'm compiling ROMS in linux, but when i was trying to compile (./build.sh), i get this error:

ROMS/Bin/cpp_clean /WORK/sio_xmzhang_2/roms/trunk/Build/distribute.f90
cd /WORK/sio_xmzhang_2/roms/trunk/Build; /usr/local/mpi3-dynamic/bin/mpif90 -c -fp-model precise -heap-arrays -g -check all -check bounds -traceback -check uninit -warn interfaces,nouncalled -gen-interfaces -free distribute.f90
ifort: command line warning #10212: -fp-model precise evaluates in source precision with Fortran.
distribute.f90(3260): error #7012: The module file cannot be read. Its format requires a more recent F90 compiler. [NETCDF]
USE netcdf
----------^
distribute.f90(3678): error #7012: The module file cannot be read. Its format requires a more recent F90 compiler. [NETCDF]
USE netcdf
----------^
distribute.f90(3298): error #6404: This name does not have a type, and must have an explicit type. [NF90_NOERR]
io_error=nf90_noerr
---------------^
distribute.f90(3352): error #6404: This name does not have a type, and must have an explicit type. [NF90_INQ_VARID]
io_error=nf90_inq_varid(ncid, TRIM(ncvname), varid)
-----------------^
distribute.f90(3362): error #6404: This name does not have a type, and must have an explicit type. [NF90_GET_VAR]
io_error=nf90_get_var(ncid, varid, Asend, start, total)
---------------------^
distribute.f90(3562): error #6404: This name does not have a type, and must have an explicit type. [NF90_INQ_VARID]
io_error=nf90_inq_varid(ncid, TRIM(ncvname), varid)
-----------------^
distribute.f90(3574): error #6404: This name does not have a type, and must have an explicit type. [NF90_GET_VAR]
io_error=nf90_get_var(ncid, varid, Asend, start, total)
---------------------^
distribute.f90(3755): error #6404: This name does not have a type, and must have an explicit type. [NF90_INQ_VARID]
io_error=nf90_inq_varid(ncid, TRIM(ncvname), varid)
-----------------^
distribute.f90(3757): error #6404: This name does not have a type, and must have an explicit type. [NF90_PUT_VAR]
io_error=nf90_put_var(ncid, varid, Arecv, start, total)
-------------------^
distribute.f90(3973): error #6404: This name does not have a type, and must have an explicit type. [NF90_INQ_VARID]
io_error=nf90_inq_varid(ncid, TRIM(ncvname), varid)
-----------------^
distribute.f90(3975): error #6404: This name does not have a type, and must have an explicit type. [NF90_PUT_VAR]
io_error=nf90_put_var(ncid, varid, Arecv, start, total)
-------------------^
compilation aborted for distribute.f90 (code 1)
make: *** [/WORK/sio_xmzhang_2/roms/trunk/Build/distribute.o] 错误 1

does any one can help me with this, thanks in advance.
Attachments
build_zgh.sh
(4.78 KiB) Downloaded 570 times

jcwarner
Posts: 1200
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

Re: compile ROMS error

#2 Unread post by jcwarner »

both the Netcdf libs and roms need to be built with the same compiler and version of that compiler.

type this:
nf-config --all

and this
mpif90 -v

find out what compiler was used to build the Netcdf libs, or have someone rebuild the netcdf with the same mpif90 that you are using.

robertson
Site Admin
Posts: 227
Joined: Wed Feb 26, 2003 3:12 pm
Location: IMCS, Rutgers University

Re: compile ROMS error

#3 Unread post by robertson »

The error implies that the netcdf module your are attempting you use was built with a newer version of ifort than you are currently attempting to use.

Are you sure you have attached the build script you used? Your build script has USE_MPI and USE_MPIF90 commented out yet the model is trying to compile with /usr/local/mpi3-dynamic/bin/mpif90. Also, what version of ROMS are you compiling? The attached build script barely resembles the current state of the ROMS build scripts.

Rachel

Re: compile ROMS error

#4 Unread post by Rachel »

Thanks for your suggestions!I edited ~/.bashrc and then check the Netcdf libs, it shows:

[sio_xmzhang_2@lon62%tianhe2-C Bin]$ nf-config --all

This netCDF-Fortran 4.4.4 has been built with the following features:

--cc -> mpicc
--cflags -> -I/WORK/app/netcdf/4.4.1/00-CF-15-par/include -I/WORK/app/netcdf/4.4.1/00-CF-15-par/include

--fc -> mpif90
--fflags -> -I/WORK/app/netcdf/4.4.1/00-CF-15-par/include
--flibs -> -L/WORK/app/netcdf/4.4.1/00-CF-15-par/lib -lnetcdff -L/WORK/app/netcdf/4.4.1/00-CF-15-par/lib -lnetcdf -lnetcdf
--has-f90 -> no
--has-f03 -> yes

--has-nc2 -> yes
--has-nc4 -> yes

--prefix -> /WORK/app/netcdf/4.4.1/00-CF-15-par
--includedir-> /WORK/app/netcdf/4.4.1/00-CF-15-par/include
--version -> netCDF-Fortran 4.4.4

and this
[sio_xmzhang_2@lon62%tianhe2-C Bin]$ mpif90 -v
mpifort for MPICH version 3.1.3
ifort version 15.0.1

The revision of ROMS and the build script that i'm compling are 884, but i got a new error, is it still the netcdf module problem? please help me:
.....
mod_netcdf.f90:(.text+0x17b2a): undefined reference to `netcdf_mp_nf90_inq_varid_'
/WORK/sio_xmzhang_2/roms/trunk884/lu/Build/libMODS.a(mod_netcdf.o): In function `mod_netcdf_mp_netcdf_put_ivar_1d_':
mod_netcdf.f90:(.text+0x180b4): undefined reference to `netcdf_mp_nf90_put_var_1d_fourbyteint_'
mod_netcdf.f90:(.text+0x18402): undefined reference to `netcdf_mp_nf90_inq_varid_'
/WORK/sio_xmzhang_2/roms/trunk884/lu/Build/libMODS.a(mod_netcdf.o): In function `mod_netcdf_mp_netcdf_put_ivar_2d_':
mod_netcdf.f90:(.text+0x18a34): undefined reference to `netcdf_mp_nf90_put_var_2d_fourbyteint_'
mod_netcdf.f90:(.text+0x18d82): undefined reference to `netcdf_mp_nf90_inq_varid_'
/WORK/sio_xmzhang_2/roms/trunk884/lu/Build/libMODS.a(mod_netcdf.o): In function `mod_netcdf_mp_netcdf_put_lvar_0d_':
mod_netcdf.f90:(.text+0x1930e): undefined reference to `netcdf_mp_nf90_put_var_fourbyteint_'
mod_netcdf.f90:(.text+0x193ac): undefined reference to `netcdf_mp_nf90_put_var_1d_fourbyteint_'
mod_netcdf.f90:(.text+0x1976c): undefined reference to `netcdf_mp_nf90_inq_varid_'
/WORK/sio_xmzhang_2/roms/trunk884/lu/Build/libMODS.a(mod_netcdf.o): In function `mod_netcdf_mp_netcdf_put_lvar_1d_':
mod_netcdf.f90:(.text+0x19ec0): undefined reference to `netcdf_mp_nf90_put_var_1d_fourbyteint_'
mod_netcdf.f90:(.text+0x1a175): undefined reference to `netcdf_mp_nf90_inq_varid_'
/WORK/sio_xmzhang_2/roms/trunk884/lu/Build/libMODS.a(mod_netcdf.o): In function `mod_netcdf_mp_netcdf_put_lvar_2d_':
mod_netcdf.f90:(.text+0x1aa7b): undefined reference to `netcdf_mp_nf90_put_var_2d_fourbyteint_'
mod_netcdf.f90:(.text+0x1ad60): undefined reference to `netcdf_mp_nf90_inq_varid_'
/WORK/sio_xmzhang_2/roms/trunk884/lu/Build/libMODS.a(mod_netcdf.o): In function `mod_netcdf_mp_netcdf_put_svar_0d_':
mod_netcdf.f90:(.text+0x1b2b7): undefined reference to `netcdf_mp_nf90_put_var_text_'
mod_netcdf.f90:(.text+0x1b6e4): undefined reference to `netcdf_mp_nf90_inq_varid_'
/WORK/sio_xmzhang_2/roms/trunk884/lu/Build/libMODS.a(mod_netcdf.o): In function `mod_netcdf_mp_netcdf_put_svar_1d_':
mod_netcdf.f90:(.text+0x1bc94): undefined reference to `netcdf_mp_nf90_put_var_1d_text_'
mod_netcdf.f90:(.text+0x1c054): undefined reference to `netcdf_mp_nf90_inq_varid_'
/WORK/sio_xmzhang_2/roms/trunk884/lu/Build/libMODS.a(mod_netcdf.o): In function `mod_netcdf_mp_netcdf_create_':
mod_netcdf.f90:(.text+0x1c5b6): undefined reference to `netcdf_mp_nf90_create_'
/WORK/sio_xmzhang_2/roms/trunk884/lu/Build/libMODS.a(mod_netcdf.o): In function `mod_netcdf_mp_netcdf_enddef_':
mod_netcdf.f90:(.text+0x1c86e): undefined reference to `netcdf_mp_nf90_enddef_'
/WORK/sio_xmzhang_2/roms/trunk884/lu/Build/libMODS.a(mod_netcdf.o): In function `mod_netcdf_mp_netcdf_redef_':
mod_netcdf.f90:(.text+0x1caf5): undefined reference to `netcdf_mp_nf90_redef_'
/WORK/sio_xmzhang_2/roms/trunk884/lu/Build/libMODS.a(mod_netcdf.o): In function `mod_netcdf_mp_netcdf_sync_':
mod_netcdf.f90:(.text+0x1cd73): undefined reference to `netcdf_mp_nf90_sync_'
make: *** [/WORK/sio_xmzhang_2/roms/trunk884/lu/oceanM] 错误 1
Attachments
build.bash
(18.01 KiB) Downloaded 586 times

robertson
Site Admin
Posts: 227
Joined: Wed Feb 26, 2003 3:12 pm
Location: IMCS, Rutgers University

Re: compile ROMS error

#5 Unread post by robertson »

In your build script, uncomment the "export USE_NETCDF4=on" line. This only tells ROMS that your NetCDF library is version 4 so it can link properly, it will not result in NetCDF4/HDF5 format output files.

Also, whenever you post in the ROMS forum about an error you are encountering, the MOST important piece of information is the few line(s)/command(s) that come before the actual error. In your case, we need the linking line that lists all the libraries that the compiler is trying to link into the romsM executable, something similar to:

/opt/gfortransoft/openmpi/bin/mpif90 -frepack-arrays -fallow-argument-mismatch -g -fbounds-check -fbacktrace -fsanitize=address -fsanitize=undefined -finit-real=nan -ffpe-trap=invalid,zero,overflow -fmax-stack-var-size=64000000 -frepack-arrays -fallow-argument-mismatch -g -fbounds-check -fbacktrace -fsanitize=address -fsanitize=undefined -finit-real=nan -ffpe-trap=invalid,zero,overflow -fmax-stack-var-size=64000000 /test/Projects/Upwelling/Build_romsG/coupler.o /test/Projects/Upwelling/Build_romsG/esmf_atm.o /test/Projects/Upwelling/Build_romsG/esmf_data.o /test/Projects/Upwelling/Build_romsG/esmf_esm.o /test/Projects/Upwelling/Build_romsG/esmf_ice.o /test/Projects/Upwelling/Build_romsG/esmf_roms.o /test/Projects/Upwelling/Build_romsG/esmf_wav.o /test/Projects/Upwelling/Build_romsG/master.o /test/Projects/Upwelling/Build_romsG/mod_esmf_esm.o /test/Projects/Upwelling/Build_romsG/propagator.o /test/Projects/Upwelling/Build_romsG/roms_kernel.o -o /test/Projects/Upwelling/romsG /test/Projects/Upwelling/Build_romsG/libNLM.a /test/Projects/Upwelling/Build_romsG/libDRIVER.a /test/Projects/Upwelling/Build_romsG/libUTIL.a /test/Projects/Upwelling/Build_romsG/libNLM.a /test/Projects/Upwelling/Build_romsG/libNLM_bio.a /test/Projects/Upwelling/Build_romsG/libNLM_sed.a /test/Projects/Upwelling/Build_romsG/libANA.a /test/Projects/Upwelling/Build_romsG/libUTIL.a /test/Projects/Upwelling/Build_romsG/libDRIVER.a /test/Projects/Upwelling/Build_romsG/libMODS.a /test/Projects/Upwelling/Build_romsG/libNLM.a -L/opt/gnusoft/serial/netcdf-4.7.4/lib -lnetcdff -L/opt/gnusoft/serial/hdf5-1.10.6/lib -L/opt/gnusoft/serial/netcdf-4.7.4/lib -lnetcdf -lm -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl

pmaccc
Posts: 74
Joined: Wed Oct 22, 2003 6:59 pm
Location: U. Wash., USA

Re: compile ROMS error

#6 Unread post by pmaccc »

Dear all,

I'm having trouble compiling after updating to the most recent version. I had been able to compile with a fairly recent version (after the introduction of the new varinfo.yaml file). Now when I run my build_roms.sh it fails quickly, with only this output:

[pmacc@n3263 test0]$ ./build_roms.sh
rm -f -r core *.ipo /gscratch/macc/parker/LO_roms_user/test0/Build_roms /mmfs1/home/pmacc/make_macros.mk
cp -f /gscratch/macc/local/netcdf-ifort/include/netcdf.mod /gscratch/macc/parker/LO_roms_user/test0/Build_roms
cp -f /gscratch/macc/local/netcdf-ifort/include/typesizes.mod /gscratch/macc/parker/LO_roms_user/test0/Build_roms
cp -p /mmfs1/home/pmacc/make_macros.mk /gscratch/macc/parker/LO_roms_user/test0/Build_roms
make: *** No rule to make target '/gscratch/macc/parker/LO_roms_user/test0/Build_roms/libNLM.a', needed by '/gscratch/macc/parker/LO_roms_user/test0/romsM'. Stop.

It is not clear to me why this would have worked before and not now. Any clues would be appreciated.

Looking earlier in this thread at the post from John Warner about NetCDF, below is the output I get from the two commands he suggests. But it is not clear to me that this would be the problem. ROMS was working fine with these netCDF libraries and mpif90 yesterday, and the build script seems to fail long before it gets to any netCDF stuff.

Thanks for your help, Parker

[pmacc@klone1 test0]$ nf-config --all

This netCDF-Fortran 4.5.3 has been built with the following features:

--cc -> icc
--cflags -> -I/gscratch/macc/local/netcdf-ifort/include -I/gscratch/macc/local/netcdf-icc/include

--fc -> ifort
--fflags -> -I/gscratch/macc/local/netcdf-ifort/include -I/gscratch/macc/local/netcdf-ifort/include
--flibs -> -L/gscratch/macc/local/netcdf-ifort/lib -lnetcdff
--has-f90 ->
--has-f03 -> yes

--has-nc2 -> yes
--has-nc4 -> yes

--prefix -> /gscratch/macc/local/netcdf-ifort
--includedir-> /gscratch/macc/local/netcdf-ifort/include
--version -> netCDF-Fortran 4.5.3

[pmacc@klone1 test0]$ mpif90 -v
mpif90 for the Intel(R) MPI Library 2021.1 for Linux*
Copyright 2003-2020, Intel Corporation.
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC)

For reference here are the build script and compiler files I am using:
https://github.com/parkermac/LO_roms_us ... ld_roms.sh
https://github.com/parkermac/LO_roms_so ... x-ifort.mk

robertson
Site Admin
Posts: 227
Joined: Wed Feb 26, 2003 3:12 pm
Location: IMCS, Rutgers University

Re: compile ROMS error

#7 Unread post by robertson »

You need remove "$(SCRATCH_DIR)/libNLM.a" from line 51 of your Linux-ifort.mk so it reads:

Code: Select all

             LIBS :=
By setting LIBS to "$(SCRATCH_DIR)/libNLM.a" you are asking the make system to build that library. However, there is no longer a rule do so because ROMS now builds a single library instead of one for each subfolder. See Trac ticket #914.

pmaccc
Posts: 74
Joined: Wed Oct 22, 2003 6:59 pm
Location: U. Wash., USA

Re: compile ROMS error

#8 Unread post by pmaccc »

Thanks for the tip. Unfortunately it did not change things. Even compiling with an exact copy of the latest Linux-ifort.mk produces the same error message:

[pmacc@n3263 test0]$ ./build_roms.sh
rm -f -r core *.ipo /gscratch/macc/parker/LO_roms_user/test0/Build_roms /mmfs1/home/pmacc/make_macros.mk
cp -f /gscratch/macc/local/netcdf-ifort/include/netcdf.mod /gscratch/macc/parker/LO_roms_user/test0/Build_roms
cp -f /gscratch/macc/local/netcdf-ifort/include/typesizes.mod /gscratch/macc/parker/LO_roms_user/test0/Build_roms
cp -p /mmfs1/home/pmacc/make_macros.mk /gscratch/macc/parker/LO_roms_user/test0/Build_roms
make: *** No rule to make target '/gscratch/macc/parker/LO_roms_user/test0/Build_roms/libNLM.a', needed by '/gscratch/macc/parker/LO_roms_user/test0/romsM'. Stop.

Now I am wondering if the problem is in some of the things it copies into Build_roms at the start...I'll report back if I find anything, but if you have more suggestions I would appreciate the help.

Parker

robertson
Site Admin
Posts: 227
Joined: Wed Feb 26, 2003 3:12 pm
Location: IMCS, Rutgers University

Re: compile ROMS error

#9 Unread post by robertson »

Double check your main makefile and make sure there are no libNLM.a references in there and that all other recent changes are there as well. Somewhere there is a reference to libNLM.a. Maybe not all the Module.mk files were updated properly? Check ROMS/Nonlinear/Module.mk first.

pmaccc
Posts: 74
Joined: Wed Oct 22, 2003 6:59 pm
Location: U. Wash., USA

Re: compile ROMS error

#10 Unread post by pmaccc »

Excellent suggestion. You are a genius! It turned out that in my ROMS source folder the makefile was old (rev. 968). Notably, I had created that folder using git clone, and for some reason when I did git pull it did not update the makefile. Weird. In any case I have gone back to getting the source using svn, and it worked perfectly - compiled and ran the upwelling test case on my cluster. Hooray!

User avatar
arango
Site Admin
Posts: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: compile ROMS error

#11 Unread post by arango »

Please, update the repository. I forgot to make the required changes to the makefile during the static/share LibROMS update in the git repositories. This should fix the problem that you are having. Good luck.

azhang
Posts: 21
Joined: Fri May 11, 2007 12:49 pm
Location: CSDL/NOS/NOAA

Re: compile ROMS error

#12 Unread post by azhang »

I got compiling errors for the Revision 1122 using the same makefile, and it was fixed in the Revision 1123 as Hernan said. For Revision 1122, I have to use Build_ROMS.sh, which works fine, but not "gmake -f makefile"

User avatar
arango
Site Admin
Posts: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: compile ROMS error

#13 Unread post by arango »

The problem that was fixed yesterday was for the makefile in the git repositories. The makefile in the svn repositories was fine. Yes, we always recommend to use build_roms.sh or build_roms.csh to compile ROMS. Alternatively, you can compile ROMS with CMake using cbuild_roms.sh and cbuild_roms.csh. It is possible to compile ROMS with a single line, but you need to pass several enviromental variables and the syntax is long and easy to make mistakes. The build scripts does that for you seamlessly and gives you access to the different flags and flavors of the compilation. It is very powerful since it can run in parallel. You will notice that with the recent changes the compilation of ROMS is faster, and you have a choice to build the static and or shared libROMS (a single library).

Post Reply