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.
Hi Adam,
> When attempting to build netcdf-4.3.0, I get the following error:
>
> checking for library containing H5Fflush... -lhdf5
> checking for library containing H5DSis_scale... -lhdf5_hl
> checking hdf5.h usability... no
> checking hdf5.h presence... no
> checking for hdf5.h... no
> configure: error: Compiling a test with HDF5 failed. Either hdf5.h cannot be
> found, or config.log should be checked for other reason.
If the suggestion below doesn't work, please send the config.log file. It has
more information about the causes of such failures than the messages from
running
configure.
> HDF5 has been built and passed tests. hdf5.h is present. HDF5 was built:
> ./configure --prefix=${H5DIR} --disable-production --with-zlib=${ZDIR}
> --disable-netcdf --disable-fortran --enable-cxx && make check install
>
> Here is how I am attempting to build netcdf
> CPPFLAGS="-I${H5DIR}/include -I${H4DIR}/include -I${ZDIR}/include"
> LDFLAGS="-L${H5DIR}/lib -lhdf5 -lhdf5_hl -L${H4DIR}/lib -ldf -L${ZDIR}/lib
> -lmfhdf -lz"
> ./configure --prefix=${NCDIR} --enable-hdf4 --with-hdf5=${H5DIR} && make
> check install
It looks like you built HDF5 as a shared library, so many of the flags used to
build netcdf-4.3.0 are not needed, but I don't immediately see why including
extraneous flags should make hdf5.h not be found.
Here's exactly what worked for me, using a shared library build, with libz
installed
in /opt/lib:
1. I built HDF4 with --disable-netcdf (for reason, see
http://www.unidata.ucar.edu/software/netcdf/docs/build_hdf4.html ) :
./configure --prefix=${H4DIR} --enable-shared --disable-netcdf
--disable-fortran
make
sudo make install
2. I built HDF5 with
./configure --prefix=${H5DIR} # no --enable-shared needed, it's the
default
make all check
sudo make install
3. The netcdf-4.3.0 build was
CPPFLAGS="-I${H5DIR}/include -I${H4DIR}/include -I/opt/include" \
LDFLAGS="-L${H5DIR}/lib -L${H4DIR}/lib -L/opt/lib" \
./configure --enable-hdf4 --enable-hdf4-file-tests
make check
sudo make install
If that doesn't work for you, please send config.log.
--Russ
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu
Ticket Details
===================
Ticket ID: NYG-547290
Department: Support netCDF
Priority: Normal
Status: Closed