[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #QCH-421697]: Undefined netCDF Symbols



Hi David,

Sorry to have taken so long to respond to your question.

From the name of the netCDF binary you are installing, it appears that
it was built with gfortran rather than g77.  That means you will have
to compile your application with gfortran rather than g77, if you want
to link to that binary library.  You may even have to use a version of
gfortran compatible with the version used to make that binary, because
the conventions for calling C functions from gfortran changed during
the last couple of years.

I recommend just getting the latest netCDF source distribution (4.1.1)
and building/installing from that.  If you specify --disable-netcdf-4
as an option to configure, it will just build the netCDF-3 libraries
and executables, so you won't have to install HDF5 first.
Furthermore, the 4.1.1 version has some bugs fixed that were in
netCDF-3.6.3.

If you don't have gfortran installed already, I recommend getting a
version for MacOS-X from http://hpc.sourceforge.net/, where binary
versions for Leopard on PowerPCs are available with name
gcc-leopard-ppc-bin.tar.gz.  I recommend against getting the "gfortan
only" distribution, as you will need a gcc also that's compatible with
the gfortran.  Install this according to the instructions there, set
your PATH to something that includes the directory where gcc and
gfortran were installed, then just run

  $ CC=gcc FC=gfortran ./configure --disable-netcdf-4
  $ make all check
  $ sudo make install

to install netCDF in /usr/local, or specify somewhere else with the
--prefix option to configure.

--Russ

> Full Name: David Retchless
> Email Address: address@hidden
> Organization: Penn State University
> Package Version: binary-netcdf-3.6.3 (darwin-power_mac)
> Operating System: Mac OS X 10.5.8
> Hardware: PPC G5
> Description of problem:
> 
> Using g77 to make a Fortran 77 program exits with an error stating that
> several netCDF symbols cannot be found. All of these undefined symbols
> have a second trailing underscore, which led me to believe that I might
> have run into the infamous underscore compatibility issue between g77 and
> newer versions of Fortran. I tried adding both FFLAGS = -fno-underscoring
> and FFLAGS = -fno-second-underscore to the makefile, but neither setting
> resulted in any change in the "symbol undefined" errors.
> 
> Here's the full name of the archive from which I installed the netCDF
> binary:
> 
> binary-netcdf-3.6.3_nc3_gfortran_gfortran_g++.tar.gz - Binary distribution of 
> netcdf-3.6.3 on darwin_8.11-power_macintosh.
> 
> Here's the relevant sections of the makefile:
> 
> # A Fortran 77 compiler (e.g. g77, gfortran)
> FC=g77
> FFLAGS = -g -I$(NETCDF)/include
> 
> # The netcdf library path (http://ftp.unidata.ucar.edu/software/netcdf/)
> # defaults to /usr using debian netcdf package
> NETCDF=/usr/local/netcdf-3.6.3
> #NETCDF=/usr
> 
> And the compiler output:
> 
> make run model=HC-ori method=1 cities=Paris
> g77 -o find_analogues src/main.o src/modelProcessing.o src/funcs.o 
> src/dataRetrieval.o src/analogueSearch.o src/climateClassification.o 
> src/climateComparison.o src/gradsScriptCreation.o src/dataAggregation.o 
> src/netcdfInfo.o -L/usr/local/netcdf-3.6.3/lib -lnetcdf
> Undefined symbols:
> "_nf_def_var__", referenced from:
> _netcdfcreate_ in dataAggregation.o
> _netcdfcreate_ in dataAggregation.o
> _netcdfcreate_ in dataAggregation.o
> "_nf_inq_dimlen__", referenced from:
> _getnetcdfcoordinates_ in dataRetrieval.o
> _getnetcdfcoordinates_ in dataRetrieval.o
> _getnetcdfvarvals_ in dataRetrieval.o
> _getnetcdfvarvals_ in dataRetrieval.o
> _getnetcdfvarvals_ in dataRetrieval.o
> "_nf_put_att_double__", referenced from:
> _netcdfcreate_ in dataAggregation.o
> "_nf_get_var_real__", referenced from:
> _readsdfnetcdfcoordinates_ in dataRetrieval.o
> _readsdfnetcdfcoordinates_ in dataRetrieval.o
> _readnormalnetcdfcoordinates_ in dataRetrieval.o
> _readnormalnetcdfcoordinates_ in dataRetrieval.o
> _readnormalnetcdfcoordinates_ in dataRetrieval.o
> _readnormalnetcdfcoordinates_ in dataRetrieval.o
> _readsdfnetcdfvals_ in dataRetrieval.o
> _readnormalnetcdfvals_ in dataRetrieval.o
> "_nf_inq_var__", referenced from:
> _netcdfinfo_ in netcdfInfo.o
> "_nf_def_dim__", referenced from:
> _netcdfcreate_ in dataAggregation.o
> _netcdfcreate_ in dataAggregation.o
> "_nf_open__", referenced from:
> _getnetcdfcoordinates_ in dataRetrieval.o
> _getnetcdfvarvals_ in dataRetrieval.o
> _netcdfinfo_ in netcdfInfo.o
> "_nf_get_att_text__", referenced from:
> _netcdfinfo_ in netcdfInfo.o
> _netcdfinfo_ in netcdfInfo.o
> "_nf_put_var_real__", referenced from:
> _netcdfcreate_ in dataAggregation.o
> _netcdfcreate_ in dataAggregation.o
> _netcdfcreate_ in dataAggregation.o
> "_nf_get_att_real__", referenced from:
> _getnetcdfvarvals_ in dataRetrieval.o
> "_nf_inq_dim__", referenced from:
> _netcdfinfo_ in netcdfInfo.o
> "_nf_strerror__", referenced from:
> _handleerr_ in netcdfInfo.o
> "_nf_create__", referenced from:
> _netcdfcreate_ in dataAggregation.o
> "_nf_enddef__", referenced from:
> _netcdfcreate_ in dataAggregation.o
> "_nf_close__", referenced from:
> _netcdfcreate_ in dataAggregation.o
> "_nf_inq_varid__", referenced from:
> _getnetcdfcoordinates_ in dataRetrieval.o
> _getnetcdfcoordinates_ in dataRetrieval.o
> _getnetcdfvarvals_ in dataRetrieval.o
> "_nf_inq__", referenced from:
> _netcdfinfo_ in netcdfInfo.o
> "_nf_inq_att__", referenced from:
> _netcdfinfo_ in netcdfInfo.o
> _netcdfinfo_ in netcdfInfo.o
> "_nf_inq_attname__", referenced from:
> _netcdfinfo_ in netcdfInfo.o
> _netcdfinfo_ in netcdfInfo.o
> "_nf_put_att_text__", referenced from:
> _netcdfcreate_ in dataAggregation.o
> _netcdfcreate_ in dataAggregation.o
> _netcdfcreate_ in dataAggregation.o
> _netcdfcreate_ in dataAggregation.o
> _netcdfcreate_ in dataAggregation.o
> _netcdfcreate_ in dataAggregation.o
> _netcdfcreate_ in dataAggregation.o
> _netcdfcreate_ in dataAggregation.o
> "_nf_inq_dimid__", referenced from:
> _getnetcdfcoordinates_ in dataRetrieval.o
> _getnetcdfcoordinates_ in dataRetrieval.o
> _getnetcdfvarvals_ in dataRetrieval.o
> _getnetcdfvarvals_ in dataRetrieval.o
> _getnetcdfvarvals_ in dataRetrieval.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
> make: *** [find_analogues] Error 1
> 
> Thank you for any help you can offer. I'm new to both Fortran and netCDF;
> my apologies if I've missed something obvious.
> 
> 

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: QCH-421697
Department: Support netCDF
Priority: Emergency
Status: Closed