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

[netCDF #PPI-215162]: (No Subject)



Hi Laurie,

> I am trying to install a climate model (LOVECLIM) and for that purpose i 
> first need to install the udunit, netcdf and field package. I apparently 
> successfully installed the 3 using the configure scripts pasted below. The 
> version of netcdf i installed is netcdf 4.1.3
> However when i try to run the model i get errors that are apparently linked 
> to the netcdf package (please see type of error below). Could it come from me 
> using a wrong netcdf version? Would you know how to fix that problem?

It's not from using the wrong netCDF version, but perhaps not
installing the library (with "make install") and then not using the
right flags to link your "field" program with the installed netcdf
library.


> ***** type of error ******
> Field3D_Class.F90:(.text+0x2cc5): undefined reference to `nf_redef_'
> Field3D_Class.F90:(.text+0x2d4c): undefined reference to `nf_inq_varid_'
> Field3D_Class.F90:(.text+0x2d78): undefined reference to `nf_inq_varndims_'
> Field3D_Class.F90:(.text+0x2ecb): undefined reference to `nf_def_var_'
> Field3D_Class.F90:(.text+0x2f91): undefined reference to `nf_put_att_double_'
> Field3D_Class.F90:(.text+0x3009): undefined reference to `nf_put_att_double_'
> Field3D_Class.F90:(.text+0x307a): undefined reference to `nf_put_att_double_'
> Field3D_Class.F90:(.text+0x309d): undefined reference to `nf_enddef_'
> Field3D_Class.F90:(.text+0x32bc): undefined reference to `nf_put_vara_double_'
> Field3D_Class.F90:(.text+0x3389): undefined reference to `nf_put_att_text_'
> Field3D_Class.F90:(.text+0x33eb): undefined reference to `nf_put_att_text_'
> make: *** [emic.x] Error 1

If you install the C and Fortran netCDF libraries in LIBDIR, then you
typically need to link to those libraries with compiler flags such as

  -LLIBDIR -lnetcdff -lnetcdf

becausee the netCDF Fortran library is separate from the C library and
calls it.

> ********* Configure udunit *********
> #!/bin/bash
> export VERSION=1.12.11
> 
> export CC=icc
> export CPP="icc -E"
> export FC=ifort
> export CPPFLAGS="-Df2cFortran"
> export LDFLAGS="-L/share/apps/intel/Compiler/11.1/080/lib"
> export LIBS="-lm"
> export PERL=""
> 
> ./configure --prefix=$HOME/udunits-${VERSION}
> 
> ************** Configure netcdf ************
> #!/bin/bash
> VERSION=4.1.3
> 
> export CC=icc
> export CXX=icpc
> export CFLAGS='-03 -ip -no-prec-div'
> export CXXFLAGS='-03 -ip -no-prec-div'
> export F77=ifort
> export F90=ifort
> export FFLAGS='-03 -ip -no-prec-div -assume underscore'
> export FCFLAGS='-fPIC -assume underscore'
> export F90FLAGS='-fPIC -assume underscore'
> export CPP='icc -E'
> export CXXCPP='icpc -E'
> 
> ./configure --prefix=$HOME --enable-netcdf4 --enable-dap --with-udunits 
> --enable-shared --enable-static

Generally after running the configure script and "make" for these
packages, you also need to run "make check" (for testing that the
package was built and runs as intended) and "make install" (to install
the include files and libraries properly in the include/ and lib/
subdirectories of the directory specified with the --prefix= option.

Since you specified "--with-udunits", that library will be built as
part of the netCDF build process, and "make install" will install it
in the same directories as netCDF, so it wasn't necessary to do the
previous step of building and installing udunits separately.

> ********** configure field
> 
> #!/bin/bash
> VERSION=1.2
> 
> export CC=icc
> export CXX=icpc
> export CPP="icc -E"
> export CXXCPP="icpc -E"
> export FC=ifort
> export F90=ifort
> CPPFLAGS="-DPTR=integer*4"
> export CFLAGS="-O2 -fp-model precise "
> export FFLAGS="${CPPFLAGS} -free -O2 -fp-model precise -convert big_endian 
> -real-size 64 -integer-size 32"
> export F90FLAGS=${FFLAGS}
> 
> ./configure --prefix=$HOME/field --with-netcdf=$HOME 
> --with-udunits=$HOME/udunits-1.12.11

I don't know anything about the "field" package, but it might require
setting additional environment variables to tell it that both
-lnetcdff (for the netCDF Fortran library) and -lnetcdf (for the
netCDF C library) are required when linking.  For example,

  export LDFLAGS='-L${HOME}/lib -lnetcdff -lnetcdf'

or maybe it would be enough to add the location of the installed
shared library with

  export LD_LIBRARY_PATH=${HOME}/lib:$LD_LIBRARY_PATH

--Russ

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



Ticket Details
===================
Ticket ID: PPI-215162
Department: Support netCDF
Priority: High
Status: Closed