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.
I'm forwarding this, Cc:ing support-netcdf, to get the answer into the archives. The symptom was when building netCDF-4.1.1-rc1 on a MacOS-X 10.6 system, the following error message occurred in running configure: $ CC=/usr/bin/gcc FC='' CXX='' ./configure --with-hdf5=$HDFDIR --with-zlib=/usr/lib ... checking for H5Fflush in -lhdf5... no configure: error: Can't find the hdf5 header and/or library, or can't link a program to it. HDF5 must be built with zlib; the location of zlib must be specified for netCDF-4 with the --with-zlib option. If HDF5 was also built with szlib, then the location of szlib must also be specified with the --with-slib option. There were two causes identified for this in different instances: 1. A leftover shared 32-bit libhdf5.so from a previous build, which hid the search in the 64-bit libhdf5.a. Removing the old shared library made things work. This was revealed by looking at config.log instead of the error message from configure. 2. Omitting "-m64" from CFLAGS when configuring and specifying a 64-bit HDF5 library in $HDFDIR. In this case explicit "-m64" flags were also needed for FFLAGS and FCFLAGS for the corresponding gfortran compiles. --Russ