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 Chris, > I am trying to compile netcdf-cxx4-4.2.tar.gz and receive the error > message: > > configure: error: NetCDF must be built with netCDF-4 enabled. > > History: I first compile zlib and hdf5 and then compile netcdf-4.0.tar.gz, > enableing netCDF4 as follows: > > ./configure --enable-netcdf-4 --with-zlib=/usr/local/zlib > --with-hdf5=/usr/lib/ > make check > sudo make install > > All Checks are fine. I then try to compile netcdf-cxx4-4.2.tar.gz > starting with "./configure" and receive the output included below. My > NetCDF libraries are located in /usr/local. I think the compiler is fine > with this path, given that it does find "netcdf.h" which is located in > "/usr/local/include". Can you give me a hint on how configure netCDF-cxx4 > 4.2 correctly? Assuming you built the netCDF-4 and HDF5 libraries as shared libraries, which would be the default unless you configured with "--disable-shared", you should add the path to the shared libraries to your LD_LIBRARY_PATH environment variable before running the configure script. For example LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib export LD_LIBRARY_PATH ./configure ... If this gets you further but you still have problems, I recommend using the latest version of the netCDF C library, 4.2.1.1, and installing that before trying to build the C++ library. The configure script in version 4.2.1.1 no longer supports the "--with-hdf5=" option, so you need to specify where you installed the HDF5 library using the CPPFLAGS and LDFLAGS environment variables, as described here: http://www.unidata.ucar.edu/netcdf/docs/build_default.html For example, you could use CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./configure --Russ > ### > configure: netCDF-cxx4 4.2 > checking build system type... x86_64-unknown-linux-gnu > checking host system type... x86_64-unknown-linux-gnu > checking target system type... x86_64-unknown-linux-gnu > checking for a BSD-compatible install... /usr/bin/install -c > checking whether build environment is sane... yes > checking for a thread-safe mkdir -p... /bin/mkdir -p > checking for gawk... gawk > checking whether make sets $(MAKE)... yes > configure: checking user options > checking whether netCDF extra tests should be run (developers only)... no > checking whether large file (> 2GB) tests should be run... no > checking whether benchmaks should be run (experimental)... no > checking where to put large temp files if large file tests are run... . > configure: finding other utilities > configure: setting up libtool > checking how to print strings... printf > checking for style of include used by make... GNU > checking for gcc... gcc > checking whether the C compiler works... yes > checking for C compiler default output file name... a.out > checking for suffix of executables... > checking whether we are cross compiling... no > checking for suffix of object files... o > checking whether we are using the GNU C compiler... yes > checking whether gcc accepts -g... yes > checking for gcc option to accept ISO C89... none needed > checking dependency style of gcc... gcc3 > checking for a sed that does not truncate output... /bin/sed > checking for grep that handles long lines and -e... /bin/grep > checking for egrep... /bin/grep -E > checking for fgrep... /bin/grep -F > checking for ld used by gcc... /usr/bin/ld > checking if the linker (/usr/bin/ld) is GNU ld... yes > checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B > checking the name lister (/usr/bin/nm -B) interface... BSD nm > checking whether ln -s works... yes > checking the maximum length of command line arguments... 1572864 > checking whether the shell understands some XSI constructs... yes > checking whether the shell understands "+="... yes > checking for /usr/bin/ld option to reload object files... -r > checking for objdump... objdump > checking how to recognize dependent libraries... pass_all > checking for ar... ar > checking for strip... strip > checking for ranlib... ranlib > checking command to parse /usr/bin/nm -B output from gcc object... ok > checking how to run the C preprocessor... gcc -E > checking for ANSI C header files... yes > checking for sys/types.h... yes > checking for sys/stat.h... yes > checking for stdlib.h... yes > checking for string.h... yes > checking for memory.h... yes > checking for strings.h... yes > checking for inttypes.h... yes > checking for stdint.h... yes > checking for unistd.h... yes > checking for dlfcn.h... yes > checking for objdir... .libs > checking if gcc supports -fno-rtti -fno-exceptions... no > checking for gcc option to produce PIC... -fPIC -DPIC > checking if gcc PIC flag -fPIC -DPIC works... yes > checking if gcc static flag -static works... yes > checking if gcc supports -c -o file.o... yes > checking if gcc supports -c -o file.o... (cached) yes > checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared > libraries... yes > checking whether -lc should be explicitly linked in... no > checking dynamic linker characteristics... GNU/Linux ld.so > checking how to hardcode library paths into programs... immediate > checking whether stripping libraries is possible... yes > checking if libtool supports shared libraries... yes > checking whether to build shared libraries... yes > checking whether to build static libraries... yes > checking for g++... g++ > checking whether we are using the GNU C++ compiler... yes > checking whether g++ accepts -g... yes > checking dependency style of g++... gcc3 > checking how to run the C++ preprocessor... g++ -E > checking for ld used by g++... /usr/bin/ld -m elf_x86_64 > checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes > checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared > libraries... yes > checking for g++ option to produce PIC... -fPIC -DPIC > checking if g++ PIC flag -fPIC -DPIC works... yes > checking if g++ static flag -static works... yes > checking if g++ supports -c -o file.o... yes > checking if g++ supports -c -o file.o... (cached) yes > checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared > libraries... yes > checking dynamic linker characteristics... (cached) GNU/Linux ld.so > checking how to hardcode library paths into programs... immediate > checking for gawk... (cached) gawk > checking for gcc... (cached) gcc > checking whether we are using the GNU C compiler... (cached) yes > checking whether gcc accepts -g... (cached) yes > checking for gcc option to accept ISO C89... (cached) none needed > checking dependency style of gcc... (cached) gcc3 > checking how to run the C preprocessor... gcc -E > checking whether ln -s works... yes > checking whether make sets $(MAKE)... (cached) yes > checking stddef.h usability... yes > checking stddef.h presence... yes > checking for stddef.h... yes > checking for stdlib.h... (cached) yes > checking for string.h... (cached) yes > checking for stdbool.h that conforms to C99... yes > checking for _Bool... yes > checking for size_t... yes > checking for ptrdiff_t... yes > checking for stdlib.h... (cached) yes > checking for GNU libc compatible malloc... yes > checking for special C compiler options needed for large files... no > checking for _FILE_OFFSET_BITS value needed for large files... no > checking netcdf.h usability... yes > checking netcdf.h presence... yes > checking for netcdf.h... yes > checking for library containing nc_create... no > checking for nc_def_opaque... no > checking for nccreate... no > checking for nc_set_log_level... no > checking for oc_open... no > checking for nc_use_parallel_enabled... no > configure: error: NetCDF must be built with netCDF-4 enabled. > > Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: JQJ-706508 Department: Support netCDF Priority: Normal Status: Closed