[Gdal-dev] gdal --with-netcdf troubles

Norman Vine nhv at cape.com
Fri Feb 18 16:37:09 EST 2005


Maciek Sieczka writes:
> 
> 1. Wanted to try to build gdal with netcdf support. Built netcdf from
> source, checkinstalled to an rpm.
> 2. When installing the netcdf from my rpm, I was informed that there is a
> conflict between the already installed hdf4 (from an rpm made with
> checkinstall as well) and the netcdf I'm trying to install.
> 3. In general - netcdf refused to install.
> 4. I noticed that some files (ncgen, ncdump, netcdf.h) are both in my netcdf
> and hdf4 rpms. Besides, there are two more files in hdf4 related to netcdf 
> by
> name - netcdf.inc, netcdf.f90. So I thought that maybe netcdf already comes
> together with hdf4 (lame, yes).
> 5. Then I tried this switch "--with-netcdf=/usr/local/lib" to see how it
> would work. And in result not only the netcdf failed to build (which I
> suspected to happen after all) but also hdf4 failed while, in theory - it
> shouldn't.

You will need to compile hdf4 locally and have it use a mangled
names version of it's internal netcdf.

The key to doing this is buried in the hdf source code

$HDF4_SRC / mfhdf / libsrc / hdf2netcdf.h

/* If using the real netCDF library and API (use -DHAVE_NETCDF)
   need to mangle the HDF versions of netCDF API function names 
   to not conflict w/ oriinal netCDF ones */

This works but you have to 'muck' with your things a bit.

Please ask on the hdf list for any further instructions on how todo this
as this is an HDF issue not a GDAL issue and we would all like to know
the 'easy' way todo this.

Good Luck

Norman



More information about the Gdal-dev mailing list