Undefined reference in libUTIL.a and libMODS.a running build_roms.sh (build.bash) for ROMS compiling (upwelling case)

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
Xegone
Posts: 8
Joined: Mon Jun 01, 2020 12:49 am
Location: University of Plymouth

Undefined reference in libUTIL.a and libMODS.a running build_roms.sh (build.bash) for ROMS compiling (upwelling case)

#1 Unread post by Xegone »

Hello there, I am new to ROMS and I am having troubles with the compiling of ROMS for the first time. I am working on a windows 10 pc.
After several unsuccessful tries with Cygwin, I decided to use Ubuntu following the steps here: http://modb.oce.ulg.ac.be/wiki/upload/OCEA0036/ROMS/
With Ubuntu and the required software install, I followed the steps in https://www.myroms.org/wiki/ROMS_Cygwin to download ROMS and customize build_roms.sh (previously known as build.bash) and my_build_path.sh.
When typing "./build_roms.sh" I seems to work fine for around 5 minutes with lots of text but no apparent errors until I get the following:

/usr/bin/ld: /home/xegone/roms/Projects/Upwelling/Build_roms/libUTIL.a(lbc.o): in function `lbc_getatt_':
lbc.f90:(.text+0x2446): undefined reference to `__netcdf_MOD_nf90_get_att_text'
/usr/bin/ld: /home/xegone/roms/Projects/Upwelling/Build_roms/libUTIL.a(lbc.o): in function `lbc_putatt_':
lbc.f90:(.text+0x301f): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/usr/bin/ld: /home/xegone/roms/Projects/Upwelling/Build_roms/libUTIL.a(def_info.o): in function `def_info_':
def_info.f90:(.text+0x6d4): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/usr/bin/ld: def_info.f90:(.text+0x861): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/usr/bin/ld: def_info.f90:(.text+0x8e8): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/usr/bin/ld: def_info.f90:(.text+0x96f): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/usr/bin/ld: /home/xegone/roms/Projects/Upwelling/Build_roms/libUTIL.a(def_info.o):def_info.f90:(.text+0x9f6): more undefined references to `__netcdf_MOD_nf90_put_att_text' follow
/usr/bin/ld: /home/xegone/roms/Projects/Upwelling/Build_roms/libUTIL.a(def_var.o): in function `__def_var_mod_MOD_def_var':
def_var.f90:(.text+0x248): undefined reference to `__netcdf_MOD_nf90_def_var_manydims'
/usr/bin/ld: def_var.f90:(.text+0x3c2): undefined reference to `__netcdf_MOD_nf90_put_att_one_eightbytereal'
/usr/bin/ld: def_var.f90:(.text+0x499): undefined reference to `__netcdf_MOD_nf90_put_att_one_eightbytereal'
/usr/bin/ld: def_var.f90:(.text+0x620): undefined reference to `__netcdf_MOD_nf90_put_att_eightbytereal'
/usr/bin/ld: def_var.f90:(.text+0x768): undefined reference to `__netcdf_MOD_nf90_put_att_one_eightbytereal'
/usr/bin/ld: def_var.f90:(.text+0x83b): undefined reference to `__netcdf_MOD_nf90_put_att_one_eightbytereal'
/usr/bin/ld: def_var.f90:(.text+0x913): undefined reference to `__netcdf_MOD_nf90_put_att_one_eightbytereal'
/usr/bin/ld: def_var.f90:(.text+0xb9d): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/usr/bin/ld: def_var.f90:(.text+0xc41): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/usr/bin/ld: def_var.f90:(.text+0xe29): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/usr/bin/ld: def_var.f90:(.text+0xeef): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/usr/bin/ld: def_var.f90:(.text+0xf69): undefined reference to `__netcdf_MOD_nf90_put_att_text'[/b][/b][/b]



The error list continues with around 250-300 lines of undefined references, all of them related with the files libUTIL.a and libMODS.a inside the newly created "Build_roms" folder. The last lines of the output are the following:

/usr/bin/ld: /home/xegone/roms/Projects/Upwelling/Build_roms/libMODS.a(mod_netcdf.o): in function `__mod_netcdf_MOD_netcdf_get_dim':
mod_netcdf.f90:(.text+0x184e7): undefined reference to `__netcdf_MOD_nf90_inquire'
/usr/bin/ld: mod_netcdf.f90:(.text+0x185a9): undefined reference to `__netcdf_MOD_nf90_inquire_dimension'
/usr/bin/ld: mod_netcdf.f90:(.text+0x186bc): undefined reference to `__netcdf_MOD_nf90_strerror'
collect2: error: ld returned 1 exit status
make: *** [Master/Module.mk:22: /home/xegone/roms/Projects/Upwelling/romsS] Error 1



Did anyone have this issue or a similar one? Any ideas of how can I fix it?

gfortran version: GNU Fortran 9.3.0
NetCDF version:
--> netCDF-Fortran 4.5.2 (nf config)
--> netCDF 4.7.3 (nc config)

Best regards
Xegone

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

Re: Undefined reference in libUTIL.a and libMODS.a running build_roms.sh (build.bash) for ROMS compiling (upwelling case

#2 Unread post by robertson »

We need to see the command that came right before all your undefined references. Also, do you have "USE_NETCDF4" set to on your build_roms.sh?

Xegone
Posts: 8
Joined: Mon Jun 01, 2020 12:49 am
Location: University of Plymouth

Re: Undefined reference in libUTIL.a and libMODS.a running build_roms.sh (build.bash) for ROMS compiling (upwelling case

#3 Unread post by Xegone »

You are amazing robertson! That was my mistake, "USE_NETCDF4" was commented. I know it is a simple thing for you but you made my day, and saved me hours of work.

Have a good day

Xegone

Post Reply