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

[netCDF #GMY-926494]: Fortran links missing in libnetcdf.a



> I have installed netCDF v. 3.6.2 with gfortran v. 4.3 and gcc v. 4.0.1 on
> my Mac Pro OSX 10.5 Leopard with Intel processors and Darwin 9.1.0. It
> passed all the make test tests. However, when I run an nm -g on
> libnetcdf.a, I dont get any entries for for the fort-*.o objects (listed
> below).  I do have a netcdf-3.6.2/Fortran directory with these objects in
> it. As a result, I get a list of undefined symbols (also listed below)
> when I try to install another Fortran/C program (ioapi v. 3.0) that
> requires netCDF.
>
> I specifically ran netCDF configure so that it would stop if the fortran
> compiler was unavailable:
> >> ./configure --enable-large-file-tests --enable-shared
> --disable-compiler-recover.
> The automatically set code generation options were:
> FFLAGS -g -O2
> CPPFLAGS
> CFLAGS -g -O2
> CXXFLAGS -g -O2
> I linked libnetcdf.a to the installation directory before I installed
> ioapi so it is not a path problem. I have also traded several e-mails with
> the ioapi support, but they say this is a netCDF issue.
>
> I looked through the netCDF FAQs, Forum, and Mailing lists at gfortran
> problems and reinstalled netCDF with:
>
> CPPFLAGS = -DpgiFortran
>
> but the problem remains.
>
> What should I do next? I am attaching my installation logs, the nm -g for
> libnetcdf.a, and the list from the Fortran subdirectory. Let me know if
> you need any additional information. Thank you.
>
> Debra Baker
> Department of Atmospheric
> and Oceanic Sciences
> University of Maryland

Howdy Debra!

Sorry it took me so long to reply! Like most people around here I was at the
annual AMS meeting for a week.

The good news is that your netCDF fortran library is definitely working, as can
be seen in your make check output:

 *** testing ncredf, ncdren, ncvren, ncaren, ncendf ...
 *** testing ncacpy ...
 *** testing ncadel ...
 *** testing fill values ...
 Total number of failures:            0
 *** SUCCESS!
PASS: ftest
 *** Testing netCDF-3 Fortran 90 API.
 *** SUCCESS!
PASS: tst_f90
==================
All 5 tests passed
==================

>
> Not in libnetcdf.a but in /netcdf-3.6.2/Fortran:
> fort-attio.o
> fort-control.o
> fort-dim.o
> fort-genatt.o
> fort-geninq.o
> fort-genvar.o
> fort-lib.o
> fort-misc.o
> fort-v2compat.o
> fort-var1io.o
> fort-varaio.o
> fort-vario.o
> fort-varmio.o
> fort-varsio.o

I don't believe these should appear in the nm output, but I haven't really
looked into it. In any case, your netcdf library is built correctly, which is
good.

>
> Undefined symbols from ioapi make:
> _ncabor
> _ncagt,
> _ncagtc
> _ncanam
> _ncapt
> _ncaptc
> _ncclos
> _ncddef
> _ncdid
> _ncdinq
> _ncendf
> _ncpopt
> _ncredf
> _ncsnc
> _ncvdef
> _ncvgt
> _ncvgt1
> _ncvgtc
> _ncvid
> _ncvinq
> _ncvpt1
> _ncvptc
> _nf_create
> _nf_inq_libvers
> _nf_open
> _nf_strerror
> _nf_sync
>
>
>

This is a tough one!

As I understand it, you are building this ioapi package from source, and
attempting to link to the netCDF library, and it is not working. Is that it?

Does ioapi contain fortran code? I assume yes.

Are you using the same fortran compiler in both cases? That is ioapi building
with the same fortran compiler as was used when netCDF was built? (gfortran,
from your output).

Are you sure there are no other copies of the netCDF library, perhaps created
by different versions of gfortran, which are hanging around in your path?

The problem you are seeing looks like one that crops up because gfortran
changed the way it handles underscores in function names. If this is the
problem, the easiest way to fix it is to make sure the same version of gfortran
is used in both cases.

If none of that helps, please send me the compile line that's not working, and
if you can, CC the ioapi people as well, and we can sort this out together.

Thanks,

Ed

Ticket Details
===================
Ticket ID: GMY-926494
Department: Support netCDF
Priority: Normal
Status: Open