NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Phil, > I've been trying the various compilation options for NetCDF with version > 4 support for a couple of days without success. It seems that no matter > how I attempt to do this I am presented with the message below when > executing ./configure: > > 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. Usually that message just indicates you haven't specified to the configure script where HDF5 is installed, in a way that the configure script can understand. It does not understand "--with-hdf5=PATH", as you can check by running configure --help. You have to use CPPFLAGS and LDFLAGS, and you also sometimes have to use LD_LIBRARY_PATH, as explained at http://www.unidata.ucar.edu/netcdf/docs/getting_and_building_netcdf.html#build_default ... Before building netCDF, you may need to add ${H5DIR}/lib to the LD_LIBRARY_PATH environment variable if that lib directory is not searched by default. See the netCDF FAQ for more details on using shared libraries. > I'm compiling and installing zlib without trouble. HDF5 also appears > to install without problem. Although the trouble I've been experiencing > has led me to compile this with szip and with C++ and Fortran enabled. It is not necessary (or even useful for netCDF) to compile with any of those enabled. > I started out installing these in standaline directories, > e.g. /home/me/zlib and /home/me/hdf5. With this approach I used the > --with-zlib=/home/me/zlib and --with-hdf5=/home/me/hdf5 switches. Those switches are how HDF5 wants you to specify library locations, but netCDF-4 doesn't use --with-PACKAGE=PATH that way. We followed the previous GNU autoconf guidelines and standards, which said to use the "with-PACKAGE=VERSION" syntax to specify when a particular version was required or "with-PACKAGE=no" if a particular library third party library was not to be used. (See http://web.mit.edu/gnu/doc/html/autoconf_9.html or https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/External-Software.html for the previous autoconf guidelines.) This is probably more than you wanted to know about the --with-PACKAGE= option, but explains why we use CPPFLAGS= and LDFLAGS= environment variables instead. The configure script should have given you a warning about unrecognized configure options when you used --with-hdf5= $ ../configure --with-hdf5=/usr/local/lib configure: WARNING: unrecognized options: --with-hdf5 but it's easy to miss, as its just a warning and not an error. > ... I've > also followed the suggestion in the NetCDF installation instructions > (https://www.unidata.ucar.edu/software/netcdf/docs/build_default.html) > of installing all these libraries in a common directory tree, and thus set > CPPFLAGS and LDFLAGS accordingly. Yet every time, I get the same message. Make sure you are actually using environment variables instead of plain shell variables, either by using the shell "export" command or by setting them on the same command line as used to invoke the configure script. You can check for CPPFLAGS and LDFLAGS settings in the config.log file, and if they are not set (as is the case in the config.log you sent), then you know the location of the HDF5 library has not been specified to the configure script. > Please see my latest config.log file attached. Do you have any idea > what's going wrong? Another possibility is that you are trying to build the software as root, rather than as a normal user. Environment variables such as LDFLAGS or LD_LIBRARY_PATH are *not inherited* by scripts invoked by root, such as the configure script. You can run "make install" as root or using "sudo", but you should not run "configure" as root or with "sudo". If you follow the examples in the build documentation exactly, everything should work, as we test on various Linux and OSX platforms. If setting CPPFLAGS, LDFLAGS, and possibly LD_LIBRARY_PATH doesn't work, please send us the resulting config.log file. --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: NOM-755338 Department: Support netCDF Priority: Normal Status: Closed