[ncl-install] sd_nc* undefined references

Jeff Dusenberry jdusenberry at whoi.edu
Wed Mar 5 13:35:51 MST 2008


Hi Rick,

Thanks.  I didn't see that first link, and I misread the "special note 
on HDF4 software" on the second as implying I needed to keep the 
--enable-netcdf option.

Now I have a different issue in that the build is looking for 
hdf/netcdf.h, which no longer exists since I rebuilt hdf.  I've tried 
this a few different ways, without success, but I'm probably missing 
something simple.  Any ideas?

Thanks,
Jeff

gcc -c -DLINUX -ansi -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O 
  -I../.
./.././include -I/usr/X11R6/include 
-I/usr/local/netcdf-3.6.2-nofortran/include
-I/usr/local/hdf/include  -DLinux -DMAJOR=2       -DSYSV -D_POSIX_SOURCE 
-D_XOPE
N_SOURCE -DByteSwapped -DNeedFuncProto  NclHDF.c
NclHDF.c:27:24: hdf/netcdf.h: No such file or directory
NclHDF.c:66: `MAX_VAR_DIMS' undeclared here (not in a function)
NclHDF.c: In function `HDFToNCLName':
NclHDF.c:311: `MAX_NC_NAME' undeclared (first use in this function)
NclHDF.c:311: (Each undeclared identifier is reported only once
NclHDF.c:311: for each function it appears in.)
NclHDF.c: In function `GetSDInfo':
NclHDF.c:463: `MAX_VAR_DIMS' undeclared (first use in this function)
NclHDF.c:465: `MAX_NC_NAME' undeclared (first use in this function)
NclHDF.c: In function `HDFOpenFile':
NclHDF.c:650: `MAX_NC_NAME' undeclared (first use in this function)
NclHDF.c: In function `HDFReadVar':
NclHDF.c:1250: `MAX_NC_DIMS' undeclared (first use in this function)
NclHDF.c: In function `HDFWriteVar':
NclHDF.c:1470: `MAX_NC_DIMS' undeclared (first use in this function)
NclHDF.c: In function `HDFAddVar':
NclHDF.c:1953: `MAX_NC_DIMS' undeclared (first use in this function)
make[4]: *** [NclHDF.o] Error 1


Rick Grubin wrote:
> Hi Jeff
> 
>> I'm getting undefined references to `sd_nc*' errors when attempting to 
>> build NCL 5.0.0 on a RHEL3 system.  HDF4 was compiled with 
>> --enable-netcdf turned on.  Can anyone tell me where the references 
>> can be found, and/or what I might have done incorrectly?
> 
> Building HDF4 with its implementation of netCDF enabled causes problems 
> for NCL, as NCL requires the HDF build to specifically not create
> and include its own netCDF implementation into its libraries.  The 
> INSTALL file in the HDF source distribution notes:
> 
> 4. Using HDF/MFHDF libraries with original netCDF library
>    ======================================================
> 
>    To use the HDF/MFHDF libraries (libdf.a, libmfhdf.a) with the
>    original netCDF library (libnetcdf.a), the HDF4 distribution
>    must be configured with the --disable-netcdf configuration flag.
>    This will rename the HDF version of the C-interface (ncxxx) of
>    the netCDF API to sd_ncxxx and disbale NC Fortran interfaces to
>    avoid clashing with the original netCDF C and Fortran APIs from
>    libnetcdf.a.
> 
> With HDF built enabling its own netCDF implementation, the HDF libraries 
> will not have its interfaces renamed as above, and NCL source code
> will not find the function signatures it requires to use HDF functionality.
> 
> The NCL web documentation notes how to build HDF in ways (depending on 
> the version of HDF source code you have) that are palatable
> to NCL.  Please see:
> 
> http://www.ncl.ucar.edu/Download/build_from_src.shtml#HDF-4
> http://www.ncl.ucar.edu/Download/BuildingNCL.shtml
> 
> Building/installing HDF as noted in the above documentation should take 
> care of the undefined references noted below.
> 
>> NclHDF.o(.text+0x5d): In function `HDFGetAttrVal':: undefined 
>> reference to `sd_ncattget'
>> [...]
> 
> ----   
> Rick Grubin      NCAR/TDD/CISL/VETS
> Visualization + Enabling Technologies
> grubin at ucar.edu             303.497.1832
> 
> 

-- 
Jeff Dusenberry                           email: jdusenberry at whoi.edu
Computer and Information Services, MS#46  phone: 508-289-3603
Woods Hole Oceanographic Institution      tty:   508-289-3560
Woods Hole, MA 02543-1543



More information about the ncl-install mailing list