[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #YTJ-181465]: nf_test in netcdf-fortran-4.2 fails with undefined reference
- Subject: [netCDF #YTJ-181465]: nf_test in netcdf-fortran-4.2 fails with undefined reference
- Date: Wed, 20 Feb 2013 10:00:45 -0700
>
> Russ,
>
> Thank you for your help. It is working now.
>
> I tracked the problem down to -DgFortran. I had tried it before, and deleted
> it
> when it didn't work. Unfortunately I had entered it as '-Dgfortran'.
Great, thanks for letting us know what worked!
--Russ
> Dennis
>
> On 2/19/2013 1:44 PM, Unidata netCDF Support wrote:
> > Hi Dennis,
> >
> >> Package Version: netcdf-fortran-4.2
> >> Operating System: CentOS 5.8
> >> Hardware:
> >> Description of problem:
> >>
> >> I have a problem getting nf_test in netcdf-fortran-4.2 to compile.
> >>
> >> My environment is:
> >>
> >> NETCDFHOME /usr/local/netcdf-4.2.1.1_intel_12
> >> CC mpicc
> >> FC mpif90
> >> F90 mpif90
> >> F77 mpif90
> >> CXX mpiCC
> >> CFLAGS '-O3 -fPIC -xHost -ip -no-prec-div -static-intel'
> >> CXXFLAGS '-O3 -fPIC -xHost -ip -no-prec-div -static-intel'
> >> FFLAGS '-O3 -fPIC -xHost -ip -no-prec-div -static-intel'
> >> CPP 'icc -E'
> >> CXXCPP 'icpc -E'
> >> CPPFLAGS '-I/usr/local/netcdf-4.2.1.1_intel_12/include
> >> -I/usr/local/hdf5-1.8.9_intel_12/include -I/usr/local/zlib-1.2.7_intel_12'
> >> LDFLAGS '-L/usr/local/netcdf-4.2.1.1_intel_12/lib
> >> -L/usr/local/hdf5-1.8.9_intel_12/lib
> >> -L/usr/local/zlib-1.2.7_intel_12'http://svn.unidata.ucar.edu/repos/netcdf-fortran/trunk/
> >> LD_LIBRARY_PATH
> >> /usr/local/netcdf-4.2.1.1_intel_12/lib:/usr/local/hdf5-1.8.9_intel_12/lib:/usr/local/zlib-1.2.7_intel_12:$LD_LIBRARY_PATH
> >> setenv LIBS '-lnetcdf -lhdf5_hl -lhdf5 -lz'
> >> setenv LDLIBS '-lnetcdf -lhdf5_hl -lhdf5 -lz'
> >>
> >> My configure is:
> >>
> >> configure --prefix=/usr/local/netcdf-4.2.1.1_intel_12 --enable-shared
> >> --enable-static --enable-parallel-tests
> >>
> >> 'make' completes with no errors.
> >>
> >> A 'make check' fails at this point:
> >>
> >> ...
> >> libtool: link: mpif90 -I../fortran -I../f90 -O3 -fPIC -xHost -ip
> >> -no-prec-div -static-intel -o .libs/nf_test test_get.o test_put.o
> >> nf_error.o nf_test.o test_read.o test_write.o util.o fortlib.o
> >> -L/usr/local/netcdf-4.2.1.1_intel_12/lib
> >> -L/usr/local/hdf5-1.8.9_intel_12/lib -L/usr/local/zlib-1.2.7_intel_12
> >> ../fortran/.libs/libnetcdff.so -L/usr/local/zlib-1.2.7/lib
> >> /usr/local/netcdf-4.2.1.1_intel_12/lib/libnetcdf.so
> >> /usr/local/hdf5-1.8.9_intel_12/lib/libhdf5_hl.so
> >> /usr/local/hdf5-1.8.9_intel_12/lib/libhdf5.so -lrt -lm -lz -Wl,-rpath
> >> -Wl,/usr/local/netcdf-4.2.1.1_intel_12/lib -Wl,-rpath
> >> -Wl,/usr/local/hdf5-1.8.9_intel_12/lib
> >> test_get.o: In function `test_nf_get_var1_text_':
> >> test_get.F:(.text+0x31): undefined reference to `nf_open_'
> >> test_get.F:(.text+0x108): undefined reference to `nf_get_var1_text_'
> >> test_get.F:(.text+0x148): undefined reference to `nf_get_var1_text_'
> >> test_get.F:(.text+0x1e0): undefined reference to `nf_get_var1_text_'
> >> test_get.F:(.text+0x2f8): undefined reference to `nf_get_var1_text_'
> >> test_get.F:(.text+0x365): undefined reference to `nf_close_'
> >> ...etc...
> >>
> >> A 'nm fortran/.libs/libnetcdff.a | grep nf_open' shows:
> >>
> >> 0000000000000250 T nf_open__
> >> 0000000000000130 T nf_open_par__
> >> U nf_open_
> >> U nf_open_par_
> >>
> >> What am I doing wrong?
> > I'm not sure, but have two suggestions to try:
> >
> > 1. Add -DgFortran to your CPPFLAGS and run configure again
> > 2. If that doesn't work, try our current netcdf-fortran test release at
> >
> > http://svn.unidata.ucar.edu/repos/netcdf-fortran/trunk/
> >
> > which uses the standard F03 C-interoperability mechanisms to call C
> > functions
> > from Fortran, so doesn't need the underbar or double-underbar name mangling
> > stuff currently in cfortran.h that only works for certain C and Fortran
> > compiler
> > combinations. If you try approach 2, you'll have to run
> >
> > autoreconf -i
> >
> > first to generate a configure script, which may entail installing the
> > autoconf
> > package, if you don't already have it.
> >
> > If one of these works, please let us know.
> >
> > --Russ
> >
> > Russ Rew UCAR Unidata Program
> > address@hidden http://www.unidata.ucar.edu
> >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: YTJ-181465
> > Department: Support netCDF
> > Priority: Normal
> > Status: Closed
> >
>
> --
> Dennis Michael
> Manager, High Productivity Technical Computing
> Stanford Center for Computational Earth and Environmental Science (CEES)
> School of Earth Sciences
> Stanford University
> 397 Panama Mall Mitchell Building room 415
> http://cees.stanford.edu/
> phone # (650) 723 2014
>
>
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu
Ticket Details
===================
Ticket ID: YTJ-181465
Department: Support netCDF
Priority: Normal
Status: Closed