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

[netCDF #BMK-872973]: [netcdf-hdf] Can't find or link to the hdf5 library.

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: [netCDF #BMK-872973]: [netcdf-hdf] Can't find or link to the hdf5 library.
  • Date: Fri, 09 Sep 2011 11:48:46 -0600

Hi Alex,

> I am running on linux 2.6 64bit, and compiling with mpich2, gcc 4.4.
> I installed HDF5-1.8.7, zlib 1.2.5, szip 2.1 and pnetcdf 1.2 and everything 
> was fine in the sense that "make check" didn't produce any error.
> 
> I am now trying to install netcdf 4.1.3 (I also tried netcdf 4.1.2 and 
> hdf5-1.8.6) was I get the following error message during configuration:
> 
> > checking for library containing H5Fflush... no
> > configure: error: Can't find or link to the hdf5 library. Use 
> > --disable-netcdf-4, or see config.log for errors.
> 
> even though I gave the following:
> --with-pnetcdf=/usr/local/pnetcdf-1.2/ --with-hdf5=/usr/local/hdf5-1.8.6 
> --with-zlib=/usr/local/zlib-1.2.5 --with-szlib=/usr/local/szip-2.1
> 
> I also tried:
> > export LDFLAGS="-L/usr/local/zlib-1.2.5/lib -L/usr/local/szip-2.1/lib 
> > -L/usr/local/netcdf-4.1.2/lib -lnetcdff -lnetcdf 
> > -L/usr/local/hdf5-1.8.6/lib -lhdf5_hl -lhdf5 -L/usr/local/zlib- 1.2.5/lib 
> > -lz -lm -lhdf5_hl -lhdf5 -lz -lm -lsz -L/usr/local/szip-2.1/lib -lsz 
> > -lhdf5_hl -lhdf5 -lz -lm -lsz-L/usr/local/hdf5-1.8.6/lib"
> > export CPPFLAGS="-fPIC -I/usr/local/zlib-1.2.5/include 
> > -I/usr/local/szip-2.1/include -I/usr/local/hdf5-1.8.6/include"
> > export LIBS="-lm -lsz"
> 
> but it does not make any difference...
> Does anybody know how to solve the problem? I am attaching the config.log 
> file.

Yes, the problem is that "--with-hdf5=..." is no longer an acceptable option to 
the
configure script, as of netCDF version 4.1.3.  Instead you must specify the 
directories
for include and library files using the environment variables LDFLAGS and 
CPPFLAGS, as in:

  LDFLAGS=-L/usr/local/hdf5-1.8.6/lib CPPFLAGS=-I/usr/local/hdf5-1.8.6/include 
./configure ...

The value of LDFLAGS should not include the "-lhdf5_hl -lhdf5".

The reason for this change was explained here:

  
http://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2011/msg00264.html

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: BMK-872973
Department: Support netCDF
Priority: Normal
Status: Closed