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 Michela, > I tried to install on a Ubuntu 11.10 system netcdf with hdf5 and zlib. > Unfortunately the installing process of netcdf fails. > > Downloaded zlib-1.2.6 > Downloaded hdf5-1.8.8 > Downloaded netcdf-4.2 > > Extracted directories in "/home/fisicatecnica/workwrf/". > > -------------------------------------------------- > In /home/fisicatecnica/workwrf/zlib-1.2.6 > -------------------------------------------------- > ./configure > --prefix=/home/fisicatecnica/workwrf/zlib-1.2.6 > make > make install The --prefix= option you used installs the software in the zlib source directory. This is not recommended, because source directories may have their own lib/ and include/ directories that you could overwrite when you later run "make install". Also, installation directories for libraries are meant to be permanent repositories where applications can make use of the libraries, but source directories can typically be moved or deleted after the software is successfully installed This probably did not cause the problem you are seeing later, but is just advice that better choices would be something like --prefix=/usr/local or --prefix=/home/fisicatecnica that don't try to install the library on top of the source files. > -------------------------------------------------- > In /home/fisicatecnica/workwrf/hdf5-1.8.8 > -------------------------------------------------- > ./configure > --with-zlib=/home/fisicatecnica/workwrf/zlib-1.2.6 > --prefix=/home/fisicatecnica/workwrf/hdf5-1.8.8 > make > make install Similar comments apply here, where you are installing HDF5 in its source directory ... > LD_LIBRARY_PATH: > export > LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/fisicatecnica/workwrf/zlib-1.2.6/lib > export > LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/fisicatecnica/workwrf/hdf5-1.8.8/lib > -------------------------------------------------- > In /home/fisicatecnica/workwrf/netcdf-4.2 > -------------------------------------------------- > ./configure > --prefix=/home/fisicatecnica/workwrf/netcdf-4.2 > --enable-netcdf4 > --with-zlib=/home/fisicatecnica/workwrf/zlib-1.2.6 > --enable-large-file-tests The actual problem is that setting LD_LIBRARY_PATH is not enough to compile code that makes use of a library. Libraries have header files such as zlib.h, hdf5.h, and netcdf.h that the compiler must know how to find when it is compiling code that makes use of functions in the library. That's why we recomend for netCDF-4.2 that you instead use the environment variables "LDFLAGS" and "CPPFLAGS" to say where the libraries are installed. For example, if you had installed zlib and hdf5 using --prefix=/home/fisicatecnica, that would have created lib/ and include/ directories ubder that prefix directory, and then you could compile and build netCDF-4.2 with: LDFLAGS=-L/home/fisicatecnica/lib CPPFLAGS=-I/home/fisicatecnica/include export LDFLAGS CPPFLAGS ./configure --prefix=/home/fisicatecnica make check make install The "--enable-netcdf4" option is not needed with netCDF-4.2, because it is the default, if the HDF5 library is found by the configure script, which it will be if you have set LDFLAGS and CPPFLAGS correctly. I recommend not to use "--enable-large-file-tests", because they make the testing take much longer and can easily cause the test to run out of disk space while running "make check". That option is really for developers who are making changes to netCDF source code, not for people installing it. You can also set LD_LIBRARY_PATH if you want to, but it's not necessary to compile, check, and install netCDF. It may be needed for later programs that make use of the netCDF library, depending on how they are compiled and linked. > While running the Makefile this error message appears: > nc4file.c: In function 'nc4_create_file': > nc4file.c:279:38: error: 'H5F_LIBVER_18' undeclared (first use in this > function) > nc4file.c:279:38: note: each undeclared identifier is reported only once for > each function it appears in > make[2]: *** [libnetcdf4_la-nc4file.lo] Errore 1 > make[2]: uscita dalla directory > "/home/fisicatecnica/workwrf/netcdf-4.2/libsrc4" > make[1]: *** [all-recursive] Errore 1 > make[1]: uscita dalla directory "/home/fisicatecnica/workwrf/netcdf-4.2" > make: *** [all] Errore 2 --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: OPQ-607149 Department: Support netCDF Priority: Normal Status: Closed