[netcdfgroup] compiling program fails with undefined references

Hi,

I'm on a Debian unstable system, with:

libnetcdf-dev (Version: 1:4.1.1-5)
libnetcdf6 (Version: 1:4.1.1-5)
netcdf-bin (Version: 1:4.1.1-5)

and I'm trying to install OTPSnc
(http://volkov.oce.orst.edu/tides/otps.html) package.  Following the
README instructions, I modified the makefile to read:

---<--------------------cut here---------------start------------------->---
ARCH = $(shell uname -s)
ifeq ($(ARCH),SunOS)
 FC = f90
 NCLIB = /home/server/local/lib.solaris2x
 NCINCLUDE = /usr/local/include
endif
ifeq ($(ARCH),Linux)
 FC = gfortran
 NCLIB = /usr/lib
 NCINCLUDE = /usr/include
 NCLIBS= -lnetcdf
endif

predict_tide: predict_tide.f subs.f constit.h
        $(FC) -o predict_tide predict_tide.f subs.f -L$(NCLIB) $(NCLIBS) 
-I$(NCINCLUDE) 
        #rm *.o
extract_HC:  extract_HC.f subs.f
        $(FC) -o extract_HC extract_HC.f subs.f -L$(NCLIB) $(NCLIBS) 
-I$(NCINCLUDE)
        #rm *.o
---<--------------------cut here---------------end--------------------->---

but compilation fails for the two targets, even though I've supplied
what I think are the proper NCLIB and NCINCLUDE variables.  Here's the
output for 'make extract_HC':

---<--------------------cut here---------------start------------------->---
gfortran -o extract_HC extract_HC.f subs.f -L/usr/lib -lnetcdf -I/usr/include
/tmp/cc3NeKK8.o: In function `MAIN__':
extract_HC.f:(.text+0x3855): undefined reference to `nf_open_'
extract_HC.f:(.text+0x3989): undefined reference to `nf_inq_dimid_'
extract_HC.f:(.text+0x39b1): undefined reference to `nf_inq_dimlen_'
extract_HC.f:(.text+0x39d9): undefined reference to `nf_inq_dimid_'
extract_HC.f:(.text+0x3a01): undefined reference to `nf_inq_dimlen_'
extract_HC.f:(.text+0x3c53): undefined reference to `nf_close_'
/tmp/cceYng2O.o: In function `rd_mod_body_nc_':
subs.f:(.text+0x8e4): undefined reference to `nf_open_'
subs.f:(.text+0xf4e): undefined reference to `nf_close_'
/tmp/cceYng2O.o: In function `rd_mod_header_nc_':
subs.f:(.text+0x2480): undefined reference to `nf_open_'
subs.f:(.text+0x24ba): undefined reference to `nf_inq_varid_'
subs.f:(.text+0x24df): undefined reference to `nf_get_var_double_'
subs.f:(.text+0x2517): undefined reference to `nf_close_'
subs.f:(.text+0x253f): undefined reference to `nf_open_'
subs.f:(.text+0x26aa): undefined reference to `nf_inq_dimid_'
subs.f:(.text+0x26ed): undefined reference to `nf_inq_dimlen_'
subs.f:(.text+0x29ea): undefined reference to `nf_open_'
subs.f:(.text+0x2a75): undefined reference to `nf_close_'
subs.f:(.text+0x2d42): undefined reference to `nf_open_'
subs.f:(.text+0x2dcd): undefined reference to `nf_close_'
subs.f:(.text+0x30e0): undefined reference to `nf_inq_varid_'
subs.f:(.text+0x310a): undefined reference to `nf_get_var_text_'
/tmp/cceYng2O.o: In function `read2d_int_nc_':
subs.f:(.text+0xb05a): undefined reference to `nf_inq_varid_'
subs.f:(.text+0xb0c5): undefined reference to `nf_get_var_int_'
/tmp/cceYng2O.o: In function `read2d_double_nc_':
subs.f:(.text+0xb56c): undefined reference to `nf_inq_varid_'
subs.f:(.text+0xb5d7): undefined reference to `nf_get_var_double_'
/tmp/cceYng2O.o: In function `read3d_double_nc_':
subs.f:(.text+0xbb0d): undefined reference to `nf_inq_varid_'
subs.f:(.text+0xbb7b): undefined reference to `nf_get_var_double_'
collect2: ld returned 1 exit status
---<--------------------cut here---------------end--------------------->---

The program extract_HC.f does have a line near the top:

include 'netcdf.inc'

which is certainly in /usr/include/netcdf.inc, so I'm surprised the
netcdf functions are not being found.  Any suggestions would be
appreciated.

Cheers,

-- 
Seb



  • 2011 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: