Compiling Trouble: Netcdf Library Location

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
mamckeon

Compiling Trouble: Netcdf Library Location

#1 Unread post by mamckeon »

Hi,

I'm trying to compile ROMS for the upwelling case using build.bash with gfortran. I'm getting the following error:

/usr/local/bin/gfortran -frepack-arrays -g -fbounds-check /Users/Maggie/ROMS/Projects/upwelling/Build/esmf_roms.o /Users/Maggie/ROMS/Projects/upwelling/Build/master.o /Users/Maggie/ROMS/Projects/upwelling/Build/ocean_control.o /Users/Maggie/ROMS/Projects/upwelling/Build/ocean_coupler.o /Users/Maggie/ROMS/Projects/upwelling/Build/propagator.o /Users/Maggie/ROMS/Projects/upwelling/Build/roms_export.o /Users/Maggie/ROMS/Projects/upwelling/Build/roms_import.o -o /Users/Maggie/ROMS/Projects/upwelling/oceanG /Users/Maggie/ROMS/Projects/upwelling/Build/libNLM.a /Users/Maggie/ROMS/Projects/upwelling/Build/libNLM_bio.a /Users/Maggie/ROMS/Projects/upwelling/Build/libNLM_sed.a /Users/Maggie/ROMS/Projects/upwelling/Build/libANA.a /Users/Maggie/ROMS/Projects/upwelling/Build/libUTIL.a /Users/Maggie/ROMS/Projects/upwelling/Build/libMODS.a -L/Users/Maggie/src/netcdf-3.6.3/f90 -lnetcdf
ld: library not found for -lnetcdf
collect2: ld returned 1 exit status
make: *** [/Users/Maggie/ROMS/Projects/upwelling/oceanG] Error 1

I know it's having trouble finding the netcdf library, but I'm not sure where to direct it. Is there a way to find it? I've tried:

/netcdf-3.6.3/libsrc
/netcdf-3.6.3/f90

Thanks for your help!

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

Re: Compiling Trouble: Netcdf Library Location

#2 Unread post by kate »

-L/Users/Maggie/src/netcdf-3.6.3/f90 -lnetcdf
It is going to look for a file called libnetcdf.a and it's going to look in the /Users/Maggie/src/netcdf-3.6.3/f90 directory. If you compile netcdf and leave things in the source tree, the library should be in perhaps a lib directory, not in the f90 directory. Try:

Code: Select all

find Users/Maggie/src/netcdf-3.6.3/ -name libnetcdf.a
I would instead configure with "--prefix=/Users/Maggie", then "make" and "make install", which should put the library in /Users/Maggie/lib.

mamckeon

Re: Compiling Trouble: Netcdf Library Location

#3 Unread post by mamckeon »

Wonderful, thanks!

Two more questions:

1. It seemed to mostly compile ok, in that it generated an oceanG executable file. I say "mostly" because there were a bunch of these types of errors:
ld: warning: can't find atom for N_GSYM stabs mran0:G(0,8) in /Users/Maggie/ROMS/Projects/upwelling/Build/libUTIL.a(ran_state.o)
ld: warning: can't find atom for N_GSYM stabs kran0:G(0,8) in /Users/Maggie/ROMS/Projects/upwelling/Build/libUTIL.a(ran_state.o)

Should I ignore them? What do they mean?

2. What is the benefit to using build scripts over makefiles?

Thank you for your help!

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

Re: Compiling Trouble: Netcdf Library Location

#4 Unread post by kate »

mamckeon wrote:Wonderful, thanks!

Two more questions:

1. It seemed to mostly compile ok, in that it generated an oceanG executable file. I say "mostly" because there were a bunch of these types of errors:
ld: warning: can't find atom for N_GSYM stabs mran0:G(0,8) in /Users/Maggie/ROMS/Projects/upwelling/Build/libUTIL.a(ran_state.o)
ld: warning: can't find atom for N_GSYM stabs kran0:G(0,8) in /Users/Maggie/ROMS/Projects/upwelling/Build/libUTIL.a(ran_state.o)

Should I ignore them? What do they mean?
Does it run? Then ignore them.
2. What is the benefit to using build scripts over makefiles?

Thank you for your help!
Haha! This is a religious issue, like vim vs emacs. Either way, you want to copy the distributed one and make changes in the copy, plus make sure that changes to the distributed one get propagated to yours. The script fanatics claim the distributed script is cleaner and changes less frequently.

Edit: make a copy for each system, each project.

Post Reply