Unidata / netcdf-cxx4

Official GitHub repository for netCDF-C++ libraries and utilities.
Other
124 stars 49 forks source link

Configure failed: NetCDF must be built with netCDF-4 enabled #61

Closed aeiou6630 closed 3 years ago

aeiou6630 commented 5 years ago

Hi,

I tried to install netcdf-cxx4.3.0 on a cluster called the TSCC (Triton Shared Computing Cluster) in UCSD, California, USA. But when configuring, I got a failure like: configure: error: NetCDF must be built with netCDF-4 enabled. I want to ask if anyone knows what might go wrong.

Let me explain the details:

(A) Background: (1) TSCC was a cluster that already had many softwares to use, including netCDF, but seemingly only the version for C. Since I wanted to use a framework called BOUT++, which required netcdf-c++, I tried to install netcdf-c++ in my (2) personal directory. (3) The directory of TSCC's netcdf-c: /opt/netcdf/4.3.2/gnu/openmpi_ib/ (4) The directory I installed local netcdf-c++: /oasis/tscc/scratch/fchang/netcdf4/netcdf-cxx4-4.3.0/install

(B) Steps I took: (1) cd /oasis/tscc/scratch/fchang/netcdf4 (2) wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-cxx4-4.3.0.tar.gz (3) tar -xzvf netcdf-cxx4-4.3.0.tar.gz (4) cd netcdf-cxx4-4.3.0 (5) mkdir install (6) ./configure -prefix="/oasis/tscc/scratch/fchang/netcdf4/netcdf-cxx4-4.3.0/install" CPPFLAGS="-I/opt/netcdf/4.3.2/gnu/openmpi_ib/include" LDFLAGs="-L/opt/netcdf/4.3.2/gnu/openmpi_ib/lib" LD_LIBRARY_PATH=/opt/netcdf/4.3.2/gnu/openmpi_ib/lib:$LD_LIBRARY_PATH

(C) Error message (1) The error message shown: 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. (2) I've also tried installing zlib-1.2.11 >> hdf5-1.10.5 >> netcdf-c-4.7.0 in my directory successfully (confirmed by make check), and intalling netcdf-cxx4-4.3.0 by including the local netcdf-c-4.7.0. But this still gave the same error message. (3) I put a full version of the message shown, and the config.log in this zip file: Failure Report.zip

I hope someone is willing to help me on this. Thanks!

DennisHeimbigner commented 5 years ago

The netcdf cxx is a wrapper around the netcdf-c library. So, you need to build and install netcdf-c library first.

aeiou6630 commented 5 years ago

Thanks for your reply.

The cluster already have netcdf-c, so I did include it when configuring (B)-(6). Besides, I've also installed netcdf-c-4.7.0 locally and include it when configuring (C)-(2).

Is that what you mentioned?

DennisHeimbigner commented 5 years ago

Not quite. Looking at the config log, it does not look like you have -lnetcdf set. The other question is: when you built netcdf-c library did you by any chance disable netcdf-4 support?

aeiou6630 commented 5 years ago

Hi,

I guess the problem was failure to linking the ./configure to the library of netcdf-c, as you mentioned. But I couldn't figure it out by myself. Specifically, when the configuring process needed to access the /lib directory, it somehow entered the /include directory, thus couldn't find what it needed.

Like this: configure:16997: checking for library containing nc_create configure:17028: gcc -o conftest -g -O2 -I/oasis/tscc/scratch/fchang/netcdf4/netcdf-c-4.7.0/install/include conftest.c >&5 /tmp/cc0x1f2b.o: In function "main": /oasis/tscc/scratch/fchang/netcdf4/netcdf-cxx4-4.3.0/conftest.c:44: undefined reference to "nc_create"

Could you give me some instruction on how to set the path of library? (I guess that's the -lnetcdf you mentioned) Thank you!


### Steps I took I put the entire process of how I built it in the following. You can skip A, B, C and D.

A. Load Module (A1) module unload intel (A2) module load gnu openmpi_ib

B. Build zlib (B1) cd /oasis/tscc/scratch/fchang/zlib/ (B2) wget https://www.zlib.net/zlib-1.2.11.tar.gz (B3) tar -xzvf zlib-1.2.11.tar.gz (B4) cd zlib-1.2.11 (B5) mkdir install (B6) ./configure --prefix=/oasis/tscc/scratch/fchang/zlib/zlib-1.2.11/ (B7) make check (B8) make install

C. Build hdf5 (C1) cd /oasis/tscc/scratch/fchang/hdf5 (C2) wget https://support.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.10.5.tar.gz (C3) tar -xzvf hdf5-1.10.5.tar.gz (C4) cd hdf5-1.10.5 (C5) mkdir install (C6) ./configure --prefix=/oasis/tscc/scratch/fchang/hdf5/hdf5-1.10.5/install (C7) make check (C8) make install

D. Build Netcdf-c (D1) cd /oasis/tscc/scratch/fchang/netcdf4 (D2) wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-c-4.7.0.tar.gz (D3) tar -xzvf netcdf-c-4.7.0.tar.gz (D4) cd netcdf-c-4.7.0 (D5) mkdir install (D6) ./configure --prefix="/oasis/tscc/scratch/fchang/netcdf4/netcdf-c-4.7.0/install" CPPFLAGS="-I/oasis/tscc/scratch/fchang/hdf5/hdf5-1.10.5/install/include -I/oasis/tscc/scratch/fchang/zlib/zlib-1.2.11/install/include" LDFLAGS="-L/oasis/tscc/scratch/fchang/hdf5/hdf5-1.10.5/install/lib -L/oasis/tscc/scratch/fchang/zlib/zlib-1.2.11/install/lib" (D7) make check (D8) make install

E. Build Netcdf-cxx (E1) cd /oasis/tscc/scratch/fchang/netcdf4 (E2) wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-cxx4-4.3.0.tar.gz (E3) tar -xzvf netcdf-cxx4-4.3.0.tar.gz (E4) cd netcdf-cxx4-4.3.0 (E5) mkdir install (E6) ./configure -prefix=/oasis/tscc/scratch/fchang/netcdf4/netcdf-cxx4-4.3.0/install CPPFLAGS=-I/oasis/tscc/scratch/fchang/netcdf4/netcdf-c-4.7.0/install/include LDFLAGs=-L/oasis/tscc/scratch/fchang/netcdf4/netcdf-c-4.7.0/install/lib LD_LIBRARY_PATH=/opt/gnu/gcc/lib64:/opt/gnu/gmp/lib:/opt/gnu/mpfr/lib:/opt/gnu/mpc/lib:LD_LIBRARY_PATH:/oasis/tscc/scratch/fchang/netcdf4/netcdf-c-4.7.0/install/lib

### Error message and config.log Configure Failure.zip

UrosCvijan commented 4 years ago

Did you get any solution for this? I have the same issue, same steps I did and still getting the error NetCDF must be built with netCDF-4 enabled.

aeiou6630 commented 4 years ago

Hi,

Sorry I haven't quite figured out this problem yet. I switched my focus to other things afterwards.

But I guess you can try adding this option in the command when configuring netcdf-c: --enable-netcdf-4

Not sure if it helps though.

UrosCvijan commented 4 years ago

Hi,

I tried with all possible flags but to no avail. Thanks for fast response.

syaoo commented 3 years ago

Has it been solved? I also have this problem. and I have successfully installed netcdf-c-4.7.4. here is some log:

checking whether filter testing should be run... yes
checking netCDF v2 API present... yes
checking netCDF-4 present... no
checking netCDF has logging... no
checking netCDF has dap... no
checking netCDF has pnetcdf... no
checking netCDF has filter support... yes
configure: error: NetCDF must be built with netCDF-4 enabled
WardF commented 3 years ago

Let me take another look at this. The config.log indicates that it is using nc_use_parallel_enabled, for some reason to indicate nc4 functionality. I'll get a fix for this, once I confirm that's what is going on. What happens if you use cmake to try to configure? Assuming you have cmake available?

WardF commented 3 years ago

@syaoo can you provide the config.log file generated?

syaoo commented 3 years ago

@syaoo can you provide the config.log file generated? I've tried to replicate the problem, but I'm not sure it's the same cause as before. Here is config.log file: netcdf-cxx-config.log I remember solving it before, but I'm not sure what was done. Now it works when you give the correct path to the NetCDF library:

./configure -prefix=/home/test/dir1/local/netcdf-cxx  CPPFLAGS="-I/home/test/dir1/local/netcdf/include -I/home/test/dir1/local/hdf5/include -I/home/test/dir1/local/zlib/include" LDFLAGS="-L/home/test/dir1/local/netcdf/lib -L/home/test/dir1/local/hdf5/lib -L/home/test/dir1/local/zlib/lib"

If the path is not given or the path is wrong, this problem occurs, like this:

./configure -prefix=/home/test/dir1/local/netcdf-cxx  CPPFLAGS="-I/home/test/dir1/local/netcdf/include -I/home/test/dir1/local/hdf5/include -I/home/test/dir1/local/zlib/include" LDFLAGS="-L/home/test/dir1/local/hdf5/lib -L/home/test/dir1/local/zlib/lib"
jprestop commented 3 years ago

I was helping a user install software for which NetCDF-CXX was a dependency, and she experienced this same problem. She was able to get NetCDF-CXX to configure and then build by adding " LIBS="-L${LIB_DIR}/lib -lhdf5_hl -lhdf5 -lz -lnetcdf" " to to the configure line like this:

./configure --prefix=${LIB_DIR} LDFLAGS=-L${LIB_DIR}/lib CPPFLAGS=-I${LIB_DIR}/include LIBS="-L${LIB_DIR}/lib -lhdf5_hl -lhdf5 -lz -lnetcdf"

aeiou6630 commented 3 years ago

Thanks for your reply!