Re: Unable to locate sd_nccreate

From: Craig Tierney <Craig.Tierney_at_nyahnyahspammersnyahnyah>
Date: Tue, 13 May 2008 08:59:49 -0600

Thanks for the detailed reply. I didn't build the HDF4 library. I will
update both Netcdf and HDF4, while following the pointers you provide below.

Craig

Rick Grubin wrote:
> 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
>
>

-- 
Craig Tierney (craig.tierney_at_noaa.gov)
_______________________________________________
ncl-install mailing list
ncl-install_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-install
Received on Tue May 13 2008 - 08:59:49 MDT

This archive was generated by hypermail 2.2.0 : Thu May 15 2008 - 09:08:53 MDT