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

[netCDF #CPW-270700]: compile error



Bin,

> Thanks Russ! I finally got the netcdf library successfully built and 
> installed.
> However, I met another problem when using the libraries. I tried to open HDF4 
> data in a C program with the following lines:
> 
> retval = nc_open("DEM_SN_H.h32v07.006_0.hdf", NC_NOWRITE, &ncid);
> ERR(retval);
> 
> I always got segmentation fault on this line.
> 
> Should I use nc_open to open HDF4 files?

Your nc_open call is correct for HDF4 files.  And the netCDF library
should not get a segmentation fault when it can't read an HDF4 file.
It's been reported as a bug that some netCDF library functions fail 
on HDF4 file inquiries for compression or chunking parameters, but I 
haven't seen any reports of a segmentation fault on just calling 
nc_open on an HDF4 file.

You should be able to use netCDF-4 on HDF4 SD (Scientific Data) files.
The netCDF library calls the HDF4 library underneath, so you have to 
build netCDF so that it knows where the HDF4 library is installed:

  
http://www.unidata.ucar.edu/netcdf/docs/getting_and_building_netcdf.html#build_hdf4

If you've done this and it still fails, and you know the file you're 
trying to open is an HDF4 SD file, please make the file available to 
us so we can try to reproduce the problem here.

Thanks.

--Russ

> -----Original Message-----
> From: Unidata netCDF Support [mailto:address@hidden]
> Sent: Thursday, May 29, 2014 10:54 PM
> To: Tan, Bin (GSFC-619.0)[SIGMA SPACE CORPORATION]
> Cc: address@hidden
> Subject: [netCDF #CPW-270700]: compile error
> 
> Bin,
> 
> > However, the program still compiled with old HDF5 libraries. Do you have 
> > any idea what else I should revise?
> 
> It might also be helpful to try these instructions that get output when you 
> successfully install the netCDF libraries:
> 
> If you ever happen to want to link against installed libraries in a
> given directory, LIBDIR, you must either use libtool, and specify
> the full pathname of the library, or use the `-LLIBDIR' flag during
> linking and do at least one of the following:
> 
> - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
> during execution
> - add LIBDIR to the `LD_RUN_PATH' environment variable
> during linking
> - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
> - have your system administrator add LIBDIR to `/etc/ld.so.conf'
> 
> See any operating system documentation about shared libraries for
> more information, such as the ld(1) and ld.so(8) manual pages.
> 
> --Russ
> 
> Russ Rew                                         UCAR Unidata Program
> address@hidden                      http://www.unidata.ucar.edu
> 
> 
> 
> Ticket Details
> ===================
> Ticket ID: CPW-270700
> Department: Support netCDF
> Priority: Normal
> Status: Closed
> 
> 
Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: CPW-270700
Department: Support netCDF
Priority: Normal
Status: Closed