[ncl-install] Unable to locate sd_nccreate
Rick Grubin
grubin at ucar.edu
Tue May 13 08:35:17 MDT 2008
Hi Craig
I'm going to break up your compile directive into pieces, as I hope
that will be easier to address a few things:
> I am getting closer to building ncl with ifort. The latest problem
> is the following:
>
> ifort -nofor-main -ansi -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -
> O2 -o ncl [...]
> -L/opt/netcdf/3.6.1_intel_9.1/lib -L/opt/udunits/1.12.4/lib -L/opt/
> hdf4/2r1_intel_9.1/lib -L/opt/netcdf/3.6.1_intel_9.1/lib -lnetcdf
> -lmfhdf -ldf
First, note that you have the netCDF library path here twice. I
don't think it hurts anything, but it's not necessary.
Also, you have netCDF v3.6.1, which is relatively out of date. The
current version is v3.6.3, and even v3.6.2 contains minor but important
security improvements.
As well, you have HDF4 v.r1, which is also relatively out of date.
The current version is v.r3 (HDF4.2r3).
It's not strictly necessary to update these external software
libraries, but I do wish to make you aware of newer versions.
> ifort: Command line warning: ignoring unknown option '-ansi'
The Intel Fortran compiler doesn't recognize the option '-ansi' ---
typically that's a C compiler directive. It's not harmful, but not
necessary.
> /opt/hdf4/2r1_intel_9.1/lib/libmfhdf.a(globdef.o)(.bss+0x0):
> multiple definition of `ncerr'
> /opt/netcdf/3.6.1_intel_9.1/lib/libnetcdf.a(v2i.o)(.bss+0x0): first
> defined here
> /opt/hdf4/2r1_intel_9.1/lib/libmfhdf.a(globdef.o)(.data+0x8):
> multiple definition of `ncopts'
> /opt/netcdf/3.6.1_intel_9.1/lib/libnetcdf.a(v2i.o)(.data+0x0):
> first defined here
> /opt/hdf4/2r1_intel_9.1/lib/libmfhdf.a(putget.o)(.text+0x0): In
> function `ncvarput1':
> : multiple definition of `ncvarput1'
>
> .. a few things deleted....
These messages indicate that the link process is finding more than
one library that contains the above-mentioned symbols. In this case,
they are first found in the netCDF library, and later in the HDF
libraries (libmfhdf.a in this case). This occurs when HDF is built
without disabling its own version of netCDF.
HDF libraries contain their own netCDF functionality, which is an
older version of netCDF (before v3.6.x) built in. For NCL to
compile, link and run properly, it's required that HDF be built by
telling the build process that you'll find that netCDF functionality
elsewhere. For HDF4.2r1, there is a file called 'INSTALL' in the
source directory that discusses this process:
To use the HDF/MFHDF libraries(libdf.a, libmfhdf.a) with the
original netCDF library(libnetcdf.a) the HDF/MFHDF distribution
must be compiled with the option '-DHAVE_NETCDF'. This will
rename the HDF version of the C-interface(ncxxx) of the
netCDF API
to sd_ncxxx to avoid clashing with the original netCDF API from
libnetcdf.a. Currently there is no support for renaming the
netCDF Fortran interface stubs. As such the HDF/MFHDF
distribution
must be compiled without fortran support. HDF Users can
still access
HDF/netCDF files through the SDxxx interface but not through
the
ncxxx interface unless the renamed interface is used(sd_ncxxx).
Note that the errors below, which are telling you that the link
process cannot find symbols such as 'sd_nccreate,' are because your
HDF libraries were not built as described above.
> NclHDF.o(.text+0x1d): In function `HDFCreateFile':
> : undefined reference to `sd_nccreate'
> [...]
NCL calls the HDF/MFHDF libraries via the 'sd_<name>' interface, and
because those functions weren't built into the libraries, they are
undefined to the linker.
> If I remove the library mfhdf, I can get the duplicate symbol
> problem to go away.
> However, I still cannot resolve missing references to sd_nccreate
> and the other sd_*
> functions. I grepped the HDF4 and NETCDF libraries, and I don't
> find them there.
You don't find the symbols in the HDF4 libraries because, as
discussed, they were not built into them. Both the 'INSTALL' file
included with the HDF4 release, and the NCL documentation located at:
http://www.ncl.ucar.edu/Download/build_from_src.shtml#HDF-4
should help you get through the build process for HDF4 correctly.
Once you've build and installed HDF4 correctly, you can re-run the
NCL make process. Please let us of know of any other questions.
----
Rick Grubin NCAR/TDD/CISL/VETS
Visualization + Enabling Technologies
grubin at ucar.edu 303.497.1832
More information about the ncl-install
mailing list