error1 Compiling the Upwelling test for the first time

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
PhilipT
Posts: 11
Joined: Thu Apr 03, 2014 6:23 pm
Location: GATECH

error1 Compiling the Upwelling test for the first time

#1 Unread post by PhilipT »

Hi all,

I'm a another new user and have been receiving the following error when I attempt to compile the Upwelling test case:

.
.
. ...more undefined references to `__netcdf_MOD_nf90_put_att_text' follow
/home/philip/MYROMS/MyTest/upwelling/Build/libMODS.a(mod_netcdf.o): In function `__mod_netcdf_MOD_netcdf_inq_var':
.
.
.
mod_netcdf.f90:(.text+0xecfa): undefined reference to `__netcdf_MOD_nf90_get_att_text'
mod_netcdf.f90:(.text+0xf02a): undefined reference to `__netcdf_MOD_nf90_get_att_one_fourbyteint'
/home/philip/MYROMS/MyTest/upwelling/Build/libMODS.a(mod_netcdf.o): In function `__mod_netcdf_MOD_netcdf_get_dim':
mod_netcdf.f90:(.text+0x103d0): undefined reference to `__netcdf_MOD_nf90_inquire'
mod_netcdf.f90:(.text+0x10476): undefined reference to `__netcdf_MOD_nf90_inquire_dimension'

collect2: ld returned 1 exit status
make: *** [/home/philip/MYROMS/MyTest/upwelling/oceanS] Error 1


Any ideas?
Thank you in advance!
Philip

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: error1 Compiling the Upwelling test for the first time

#2 Unread post by kate »

The problem is in linking with the NetCDF library. Do you have it? Did you compile it? What version is it? What does your link command look like? See also https://www.myroms.org/wiki/index.php/F ... _link_time

agilroy
Posts: 5
Joined: Wed Jul 30, 2014 11:04 pm
Location: UCSD-SIO

Re: error1 Compiling the Upwelling test for the first time

#3 Unread post by agilroy »

Hello,
I'm having a similar problem but I can't quite figure out what exactly is going wrong or where to look for a missing path/file. I have the following error:

Code: Select all

/home/agilroy/src/Projects/Upwelling/Build/libUTIL.a(close_io.o): In function `close_out_':
close_io.f90:(.text+0xb61): undefined reference to `__netcdf_MOD_nf90_strerror'
followed by many more undefined references. FYI (if needed), I'm using Netcdf C 4.2.1.1 and Netcdf fortran 4.2 on a university computing system (so I did not install these myself). Thank you in advance.
-Angelica

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: error1 Compiling the Upwelling test for the first time

#4 Unread post by kate »

Can you show us your full link command with all the -lnetcdf and -lnetcdff, etc? Did you set USE_NETCDF4 to on?

agilroy
Posts: 5
Joined: Wed Jul 30, 2014 11:04 pm
Location: UCSD-SIO

Re: error1 Compiling the Upwelling test for the first time

#5 Unread post by agilroy »

Hi Kate,
Thanks for your reply. I did set USE_NETCDF4 to on and I am using the gfotran compiler. I believe this is the block of code you'd like to see:

Code: Select all

ifdef USE_NETCDF4
        NC_CONFIG ?= nc-config
    NETCDF_INCDIR ?= $(shell $(NC_CONFIG) --prefix)/include
             LIBS := $(shell $(NC_CONFIG) --flibs)
else
    NETCDF_INCDIR ?= /opt/netcdf/4.2/gnu/openmpi/ib/include
    NETCDF_LIBDIR ?= /opt/netcdf/4.2/gnu/openmpi/ib/lib
             LIBS := -L/opt/netcdf/4.2.1.1/gnu/openmpi/ib/lib -L/opt/netcdf/4.2/gnu/openmpi/ib/lib -lnetcdff -lnetcdf
endif
If I'm mistaken please do not hesitate to ask again.
-Angelica

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: error1 Compiling the Upwelling test for the first time

#6 Unread post by kate »

Actually, I was asking for something like:

Code: Select all

/usr/local/pkg/openmpi/openmpi-1.4.3.gnu-4.7.3/bin/mpif90 -frepack-arrays -g -fbounds-check -I/usr/include  /center/w/kate/Build_ARCG/esmf_roms.o /center/w/kate/Build_ARCG/master.o /center/w/kate/Build_ARCG/ocean_control.o /center/w/kate/Build_ARCG/ocean_coupler.o /center/w/kate/Build_ARCG/propagator.o /center/w/kate/Build_ARCG/roms_export.o /center/w/kate/Build_ARCG/roms_import.o -o oceanG /center/w/kate/Build_ARCG/libMODS.a /center/w/kate/Build_ARCG/libNLM.a /center/w/kate/Build_ARCG/libNLM_bio.a /center/w/kate/Build_ARCG/libNLM_sed.a /center/w/kate/Build_ARCG/libANA.a /center/w/kate/Build_ARCG/libExtra.a /center/w/kate/Build_ARCG/libUTIL.a /center/w/kate/Build_ARCG/libMODS.a -L/usr/local/pkg/netcdf/netcdf-4.3.0.gnu-4.7.3/lib -lnetcdff -L/usr/local/pkg/hdf5/hdf5-1.8.10-p1.gnu-4.7.3/lib -L/usr/local/pkg/szip/szip-2.1.gnu/lib -L/usr/local/pkg/udunits/udunits-2.1.24.gnu-4.7.3/lib -L/usr/local/pkg/netcdf/netcdf-4.3.0.gnu-4.7.3/lib -lnetcdf -lnetcdf /center/w/kate/Build_ARCG/libCICE.a
OK, so yours won't exactly match this. ;)

One could then go to the appropriate directory and do:

Code: Select all

pacman3 312% pushd /usr/local/pkg/netcdf/netcdf-4.3.0.gnu-4.7.3/lib
pacman3 314% nm libnetcdff.so | grep strerror
0000000000069200 T __netcdf_MOD_nf90_strerror
                 U nc_strerror
00000000000135ed T nf_strerror_

agilroy
Posts: 5
Joined: Wed Jul 30, 2014 11:04 pm
Location: UCSD-SIO

Re: error1 Compiling the Upwelling test for the first time

#7 Unread post by agilroy »

Hi Kate,
Sorry for the confusion. Here it is.

Code: Select all

ROMS/Bin/cpp_clean /home/agilroy/src/Projects/Upwelling/Build/master.f90
cd /home/agilroy/src/Projects/Upwelling/Build; /usr/bin/gfortran -c -frepack-arrays -O3 -ffast-math master.f90
/usr/bin/gfortran -frepack-arrays -O3 -ffast-math  /home/agilroy/src/Projects/Upwelling/Build/esmf_roms.o /home/agilroy/src/Projects/Upwelling/Build/master.o /home/agilroy/src/Projects/Upwelling/Build/ocean_control.o /home/agilroy/src/Projects/Upwelling/Build/ocean_coupler.o /home/agilroy/src/Projects/Upwelling/Build/propagator.o /home/agilroy/src/Projects/Upwelling/Build/roms_export.o /home/agilroy/src/Projects/Upwelling/Build/roms_import.o -o /home/agilroy/src/Projects/Upwelling/oceanS /home/agilroy/src/Projects/Upwelling/Build/libUTIL.a /home/agilroy/src/Projects/Upwelling/Build/libNLM.a /home/agilroy/src/Projects/Upwelling/Build/libNLM_bio.a /home/agilroy/src/Projects/Upwelling/Build/libNLM_sed.a /home/agilroy/src/Projects/Upwelling/Build/libANA.a /home/agilroy/src/Projects/Upwelling/Build/libUTIL.a /home/agilroy/src/Projects/Upwelling/Build/libMODS.a
/home/agilroy/src/Projects/Upwelling/Build/libUTIL.a(close_io.o): In function `close_out_':
close_io.f90:(.text+0xb61): undefined reference to `__netcdf_MOD_nf90_strerror'
/home/agilroy/src/Projects/Upwelling/Build/libUTIL.a(lbc.o): In function `lbc_putatt_':
lbc.f90:(.text+0x149f): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/agilroy/src/Projects/Upwelling/Build/libUTIL.a(lbc.o): In function `lbc_getatt_':
lbc.f90:(.text+0x48af): undefined reference to `__netcdf_MOD_nf90_get_att_text'
/home/agilroy/src/Projects/Upwelling/Build/libUTIL.a(nf_fwrite2d.o): In function `__nf_fwrite2d_mod_MOD_nf_fwrite2d':
nf_fwrite2d.f90:(.text+0x498): undefined reference to `__netcdf_MOD_nf90_put_var_1d_eightbytereal'
/home/agilroy/src/Projects/Upwelling/Build/libUTIL.a(nf_fwrite3d.o): In function `__nf_fwrite3d_mod_MOD_nf_fwrite3d':
nf_fwrite3d.f90:(.text+0x5f8): undefined reference to `__netcdf_MOD_nf90_put_var_1d_eightbytereal'
/home/agilroy/src/Projects/Upwelling/Build/libUTIL.a(def_dim.o): In function `def_dim_':
def_dim.f90:(.text+0xbc): undefined reference to `__netcdf_MOD_nf90_def_dim'
and

Code: Select all

[agilroy@tscc-login2 lib]$ nm libnetcdff.so | grep strerror
0000000000012740 T __netcdf_MOD_nf90_strerror
                 U nc_strerror
000000000000cd30 T nf_strerror_
[agilroy@tscc-login2 lib]$ pwd
/opt/netcdf/4.2/gnu/openmpi/ib/lib
-Angelica

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: error1 Compiling the Upwelling test for the first time

#8 Unread post by kate »

There's nothing wrong with your libnetcdff.so, but you aren't linking to it. The code you showed before should be invoking "nc-config --flibs" as part of the link. What does it give you?

Code: Select all

einstein 228% nc-config --flibs
-L/usr/local/pkg/netcdf/netcdf-4.3.0.gnu-4.7.3/lib -lnetcdff -L/usr/local/pkg/hdf5/hdf5-1.8.10-p1.gnu-4.7.3/lib -L/usr/local/pkg/szip/szip-2.1.gnu/lib -L/usr/local/pkg/udunits/udunits-2.1.24.gnu-4.7.3/lib -L/usr/local/pkg/netcdf/netcdf-4.3.0.gnu-4.7.3/lib -lnetcdf -lnetcdf

agilroy
Posts: 5
Joined: Wed Jul 30, 2014 11:04 pm
Location: UCSD-SIO

Re: error1 Compiling the Upwelling test for the first time

#9 Unread post by agilroy »

Code: Select all

[agilroy@tscc-login1 bin]$ nc-config --flibs

[agilroy@tscc-login1 bin]$ nc-config --all

This netCDF 4.2.1.1 has been built with the following features:

  --cc        -> gcc
  --cflags    ->  -I/opt/netcdf/4.2.1.1/gnu/openmpi/ib/include -O2 -I/opt/hdf5/gnu/openmpi/ib/include -I/opt/openmpi/gnu/ib/include -L/opt/hdf5/gnu/openmpi/ib/lib
  --libs      -> -L/opt/netcdf/4.2.1.1/gnu/openmpi/ib/lib -lnetcdf

  --has-c++   -> no
  --cxx       ->
  --has-c++4  -> no
  --cxx4      ->

  --fc        ->
  --fflags    ->
  --flibs     ->
  --has-f90   -> no

  --has-dap   -> yes
  --has-nc2   -> yes
  --has-nc4   -> yes
  --has-hdf5  -> yes
  --has-hdf4  -> no
  --has-pnetcdf-> no
  --has-szlib ->

  --prefix    -> /opt/netcdf/4.2.1.1/gnu/openmpi/ib
  --includedir-> /opt/netcdf/4.2.1.1/gnu/openmpi/ib/include
  --version   -> netCDF 4.2.1.1
and then if I switch directories to Netcdf fortran bin, I get:

Code: Select all

[agilroy@tscc-login1 bin]$ nf-config --flibs
-L/opt/netcdf/4.2/gnu/openmpi/ib/lib -lnetcdff -lnetcdf
I guess I'm not sure how link to the libnetcdff.so properly.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: error1 Compiling the Upwelling test for the first time

#10 Unread post by kate »

In your case, you need to change that nc-config to nf-config. You need to make sure it is on your path so that you can execute it during the ROMS build, instead of from inside its directory:

Code: Select all

einstein 233% which nc-config
/usr/local/pkg/netcdf/netcdf-4.3.0.gnu-4.7.3/bin/nc-config
einstein 234% which nf-config
/usr/local/pkg/netcdf/netcdf-4.3.0.gnu-4.7.3/bin/nf-config

Post Reply