error message when running build.bash for upwelling

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
LeaF_7
Posts: 21
Joined: Tue Aug 12, 2014 8:32 pm
Location: Institute of Marine Research

error message when running build.bash for upwelling

#1 Unread post by LeaF_7 »

Hello,

This is a first time user of ROMS and I am trying to build the upwelling example but failed.

I am doing this with gfortran on MacOSX 10.9.4, netcdf-fortran-4.4.1rc installed

When I run ./build.bash the model finally end up with the problem below,

Code: Select all

Undefined symbols for architecture x86_64:
  "___netcdf_MOD_nf90_close", referenced from:
      ___mod_netcdf_MOD_netcdf_close in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_create", referenced from:
      ___mod_netcdf_MOD_netcdf_create in libMODS.a(mod_netcdf.o)
     .
     .
     .
  "___netcdf_MOD_nf90_put_var_text", referenced from:
      ___mod_netcdf_MOD_netcdf_put_svar_0d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_redef", referenced from:
      ___mod_netcdf_MOD_netcdf_redef in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_strerror", referenced from:
      _close_out_ in libUTIL.a(close_io.o)
  "___netcdf_MOD_nf90_sync", referenced from:
      ___mod_netcdf_MOD_netcdf_sync in libMODS.a(mod_netcdf.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [/Users/linfan/src/projects/upwelling/oceanM] Error 1
I am not quite sure what's wrong with my gfortran setup. Hope someone could help me figure this out.
And here is my nf-config --all output.

Code: Select all

--cc        -> gcc
  --cflags    ->  -I/opt/local/include 

  --fc        -> gfortran
  --fflags    -> -I/opt/local/include
  --flibs     -> -L/opt/local/lib -lnetcdff  -lnetcdf 
  --has-f90   -> no
  --has-f03   -> yes

  --has-nc2   -> no
  --has-nc4   -> no

  --prefix    -> /opt/local
  --includedir-> /opt/local/include
  --version   -> netCDF-Fortran 4.4.1-rc1
Thanks a lot!
Fan Lin

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

Re: error message when running build.bash for upwelling

#2 Unread post by kate »

My husband asks where your gfortran came from. Was it from Macports or some other source?

Also, can you provide the output of the NetCDF-fortran configure step and its Makefile?
There's a lot that can go wrong on a Mac.

LeaF_7
Posts: 21
Joined: Tue Aug 12, 2014 8:32 pm
Location: Institute of Marine Research

Re: error message when running build.bash for upwelling

#3 Unread post by LeaF_7 »

kate wrote:My husband asks where your gfortran came from. Was it from Macports or some other source?

Also, can you provide the output of the NetCDF-fortran configure step and its Makefile?
There's a lot that can go wrong on a Mac.
Thanks for the reply, Kate.

My gfortran comes from the Macports with gcc48 I think.

The output of the configure step and the Makefile are attached in txt files, I hope I provide the right thing to you. I will find a Linux machine and try ROMS on that to see what happens... Agreed on your quote there...

Thanks a lot!
Attachments
Makefile.txt
Makefile from netcdf-fortran
(33.14 KiB) Downloaded 402 times
output_configure_netcdf-fortran.rtf
out put from the ./configure in netcdf-fortran
(12.13 KiB) Downloaded 406 times

lvanroekel
Posts: 2
Joined: Thu Nov 07, 2013 8:46 pm
Location: Los Alamos National Lab

Re: error message when running build.bash for upwelling

#4 Unread post by lvanroekel »

Have you checked in your build.bash file to see if the line "export USE_NETCDF4=ON" is not commented out? If it is commented out, the Darwin-gfortran.mk file does not add
-lnetcdff to LIBS.

LeaF_7
Posts: 21
Joined: Tue Aug 12, 2014 8:32 pm
Location: Institute of Marine Research

Re: error message when running build.bash for upwelling

#5 Unread post by LeaF_7 »

Hi Ivan,

I did comment that out but it doesn't work neither.
And something interesting happened after I desperately run make uninstall in the netcdf C and fortran source directory, and I run ./build.bash and it worked... I don't know why.

I got OceanS and OceanM after compiling build.bash.

Finally ROMS give me some output, looks it worked on my machine....

Thanks to all ~

cdibble
Posts: 3
Joined: Wed Jun 04, 2014 1:45 pm
Location: UC Davis Graduate Group in Ecology

Re: error message when running build.bash for upwelling

#6 Unread post by cdibble »

I am having this same error on the build.bash run for the Upwelling test case. I am running on Mac OSX Mavericks.

I have successfully built netcdf-c and netcdf-fortran libraries from source code (I did not use MacPorts).

I installed netcdf-4 but disabled hd-5. Nevertheless, I commented-out the "export USE_NETCDF4=on" section in the build.bash file because it cannot find the libraries if I do turn that on.

When I run ./build.bash I get a lot of apparently proper execution, terminating with this:

Code: Select all

Undefined symbols for architecture x86_64:
  "___netcdf_MOD_nf90_close", referenced from:
      ___mod_netcdf_MOD_netcdf_close.part.1 in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_create", referenced from:
      ___mod_netcdf_MOD_netcdf_create in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_def_dim", referenced from:
      _def_dim_ in libUTIL.a(def_dim.o)
  "___netcdf_MOD_nf90_def_var_manydims", referenced from:
      ___def_var_mod_MOD_def_var in libUTIL.a(def_var.o)
  "___netcdf_MOD_nf90_def_var_scalar", referenced from:
      ___def_var_mod_MOD_def_var in libUTIL.a(def_var.o)
  "___netcdf_MOD_nf90_enddef", referenced from:
      ___mod_netcdf_MOD_netcdf_enddef in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_get_att_one_eightbytereal", referenced from:
      ___mod_netcdf_MOD_netcdf_get_fatt in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_inq_var in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_get_att_one_fourbyteint", referenced from:
      ___mod_netcdf_MOD_netcdf_inq_var in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_get_att_text", referenced from:
      ___mod_netcdf_MOD_netcdf_close.part.1 in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_inq_var in libMODS.a(mod_netcdf.o)
      _lbc_getatt_ in libUTIL.a(lbc.o)
  "___netcdf_MOD_nf90_get_var_1d_eightbytereal", referenced from:
      ___mod_netcdf_MOD_netcdf_get_fvar_0d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_get_fvar_1d in libMODS.a(mod_netcdf.o)
      ___nf_fread2d_mod_MOD_nf_fread2d in libUTIL.a(nf_fread2d.o)
      ___nf_fread3d_mod_MOD_nf_fread3d in libUTIL.a(nf_fread3d.o)
  "___netcdf_MOD_nf90_get_var_1d_fourbyteint", referenced from:
      ___mod_netcdf_MOD_netcdf_get_ivar_1d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_get_ivar_0d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_get_lvar_1d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_get_lvar_0d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_get_var_1d_text", referenced from:
      ___mod_netcdf_MOD_netcdf_get_svar_1d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_get_lvar_1d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_get_var_2d_eightbytereal", referenced from:
      ___mod_netcdf_MOD_netcdf_get_fvar_2d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_get_var_2d_fourbyteint", referenced from:
      ___mod_netcdf_MOD_netcdf_get_ivar_2d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_get_var_3d_eightbytereal", referenced from:
      ___mod_netcdf_MOD_netcdf_get_fvar_3d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_get_var_4d_eightbytereal", referenced from:
      ___mod_netcdf_MOD_netcdf_get_fvar_4d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_get_var_eightbytereal", referenced from:
      ___mod_netcdf_MOD_netcdf_get_fvar_0d.constprop.3 in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_get_fvar_0d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_get_var_fourbyteint", referenced from:
      ___mod_netcdf_MOD_netcdf_get_ivar_0d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_get_lvar_0d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_get_var_text", referenced from:
      ___mod_netcdf_MOD_netcdf_get_svar_0d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_get_lvar_0d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_inq_attname", referenced from:
      ___mod_netcdf_MOD_netcdf_get_fatt in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_inq_var in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_check_var in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_inq_varid", referenced from:
      ___mod_netcdf_MOD_netcdf_get_fvar_0d.constprop.3 in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_put_svar_1d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_put_svar_0d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_put_lvar_2d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_put_lvar_1d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_put_lvar_0d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_put_ivar_2d in libMODS.a(mod_netcdf.o)
      ...
  "___netcdf_MOD_nf90_inquire", referenced from:
      ___mod_netcdf_MOD_netcdf_inq_var in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_check_var in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_get_dim in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_inquire_attribute", referenced from:
      ___mod_netcdf_MOD_netcdf_inq_var in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_inquire_dimension", referenced from:
      ___mod_netcdf_MOD_netcdf_inq_var in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_get_dim in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_inquire_variable", referenced from:
      ___mod_netcdf_MOD_netcdf_get_lvar_1d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_get_lvar_0d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_get_fatt in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_inq_var in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_check_var in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_open", referenced from:
      ___mod_netcdf_MOD_netcdf_open.part.0 in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_put_att_eightbytereal", referenced from:
      ___def_var_mod_MOD_def_var in libUTIL.a(def_var.o)
  "___netcdf_MOD_nf90_put_att_fourbyteint", referenced from:
      ___def_var_mod_MOD_def_var in libUTIL.a(def_var.o)
  "___netcdf_MOD_nf90_put_att_fourbytereal", referenced from:
      ___def_var_mod_MOD_def_var in libUTIL.a(def_var.o)
  "___netcdf_MOD_nf90_put_att_one_eightbytereal", referenced from:
      ___def_var_mod_MOD_def_var in libUTIL.a(def_var.o)
  "___netcdf_MOD_nf90_put_att_one_fourbyteint", referenced from:
      ___def_var_mod_MOD_def_var in libUTIL.a(def_var.o)
  "___netcdf_MOD_nf90_put_att_one_fourbytereal", referenced from:
      ___def_var_mod_MOD_def_var in libUTIL.a(def_var.o)
  "___netcdf_MOD_nf90_put_att_text", referenced from:
      _lbc_putatt_ in libUTIL.a(lbc.o)
      ___def_var_mod_MOD_def_var in libUTIL.a(def_var.o)
      _def_info_ in libUTIL.a(def_info.o)
  "___netcdf_MOD_nf90_put_var_1d_eightbytereal", referenced from:
      ___mod_netcdf_MOD_netcdf_put_fvar_1d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_put_fvar_0d in libMODS.a(mod_netcdf.o)
      ___nf_fwrite2d_mod_MOD_nf_fwrite2d in libUTIL.a(nf_fwrite2d.o)
      ___nf_fwrite3d_mod_MOD_nf_fwrite3d in libUTIL.a(nf_fwrite3d.o)
  "___netcdf_MOD_nf90_put_var_1d_fourbyteint", referenced from:
      ___mod_netcdf_MOD_netcdf_put_lvar_1d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_put_lvar_0d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_put_ivar_1d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_put_ivar_0d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_put_var_1d_text", referenced from:
      ___mod_netcdf_MOD_netcdf_put_svar_1d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_put_var_2d_eightbytereal", referenced from:
      ___mod_netcdf_MOD_netcdf_put_fvar_2d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_put_var_2d_fourbyteint", referenced from:
      ___mod_netcdf_MOD_netcdf_put_lvar_2d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_put_ivar_2d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_put_var_3d_eightbytereal", referenced from:
      ___mod_netcdf_MOD_netcdf_put_fvar_3d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_put_var_4d_eightbytereal", referenced from:
      ___mod_netcdf_MOD_netcdf_put_fvar_4d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_put_var_eightbytereal", referenced from:
      ___mod_netcdf_MOD_netcdf_put_fvar_0d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_put_var_fourbyteint", referenced from:
      ___mod_netcdf_MOD_netcdf_put_lvar_0d in libMODS.a(mod_netcdf.o)
      ___mod_netcdf_MOD_netcdf_put_ivar_0d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_put_var_text", referenced from:
      ___mod_netcdf_MOD_netcdf_put_svar_0d in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_redef", referenced from:
      ___mod_netcdf_MOD_netcdf_redef in libMODS.a(mod_netcdf.o)
  "___netcdf_MOD_nf90_strerror", referenced from:
      _close_out_ in libUTIL.a(close_io.o)
  "___netcdf_MOD_nf90_sync", referenced from:
      ___mod_netcdf_MOD_netcdf_sync in libMODS.a(mod_netcdf.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [/Users/Connor/ROMS/Projects/Upwelling/oceanS] Error 1
I am not sure how to deal with this error- uninstalling the netcdf libraries did not help me (I'm not sure how that fixed it for the other user here).

Any help or direction would be very much appreciated.

-Connor

LeaF_7
Posts: 21
Joined: Tue Aug 12, 2014 8:32 pm
Location: Institute of Marine Research

Re: error message when running build.bash for upwelling

#7 Unread post by LeaF_7 »

Hi Connor,

If you are using the gfortran compiler, can you try to edit the Darwin-gfortran.mk under "~/yourdirectory/trunk/Compilers/" at line 51(maybe not exactly) to be:

Code: Select all

LIBS := -L$(NETCDF_LIBDIR) -lnetcdf -lnetcdff
instead of

Code: Select all

LIBS := -L$(NETCDF_LIBDIR) -lnetcdf
I am not sure this will work but try to see whether it helps. Remember to backup

cdibble
Posts: 3
Joined: Wed Jun 04, 2014 1:45 pm
Location: UC Davis Graduate Group in Ecology

Re: error message when running build.bash for upwelling

#8 Unread post by cdibble »

Wow- thank you so much for that tip. It seems to have worked- I have an oceanS file and ./build.bash ran to completion without error, anyway. I will work on running the model now and see it through. What was the function of the -lnetcdff argument added to that line?

Thank you again!

Connor

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

Re: error message when running build.bash for upwelling

#9 Unread post by kate »

With modern Netcdf, the fortran part is in a separate library. That's what you are linking to with -lnetcdff.

prasanth
Posts: 2
Joined: Tue Dec 27, 2016 3:36 pm
Location: IISC

Re: error message when running build.bash for upwelling

#10 Unread post by prasanth »

Hai,
While running build.bash for upwelling, I got the error.

mod_netcdf.f90:(.text+0x119ae): undefined reference to `__netcdf_MOD_nf90_inquire'
mod_netcdf.f90:(.text+0x11a5f): undefined reference to `__netcdf_MOD_nf90_inquire_dimension'
collect2: error: ld returned 1 exit status
Master/Module.mk:22: recipe for target '/home/prasanth/ROMS_TRAIL/Projects/Upwelling/oceanS' failed
make: *** [/home/prasanth/ROMS_TRAIL/Projects/Upwelling/oceanS] Error 1

I hope someone could help me figure this out.

-Prasanth

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

Re: error message when running build.bash for upwelling

#11 Unread post by kate »

Start with what's in the FAQ.

Post Reply