Unidata / netcdf-cxx4

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

fatal error: hdf5.h no such file or directory version NetCDF-4 C++ 4.3.1 #87

Open kandogu opened 4 years ago

kandogu commented 4 years ago

To report a non-security related issue, please provide:

On ubuntu system when I tried cmake .. command on the terminal it fails at 94% percentage because of absence hdf5.h and it cannot pass ctest can you help me?

WardF commented 4 years ago

So I notice you opening and closing this. Are you still having the issue?

kandogu commented 4 years ago

Yes I have the issue and cannot fixed, as I know hdf5.h exist, but cmake .. command does not find it and causes error.

WardF commented 4 years ago

Ok, can you provide some information on your platform, the version of netCDF-C and HDF5 you have installed, and their locations? Also, how are you invoking cmake? What does the command look like? I will try to sort this out with you. :)

kandogu commented 4 years ago

I use Ubuntu 19.10 and installed netCDF-4 C++ 4.3.1. For hdf5 I install libdhdf5-dev and its version is 1.10.4+repack-10, location of hdf5 is /usr/include/hdf5/serial/hdf5.h and netCDF library direction is /usr/lib/x86_64-linux-gnu. I'm trying to invoke cmake command as you told in the guide.

canning dependencies of target test_bzip2 [85%] Building C object plugins/CMakeFiles/test_bzip2.dir/blocksort.c.o [ 87%] Building C object plugins/CMakeFiles/test_bzip2.dir/huffman.c.o [ 88%] Building C object plugins/CMakeFiles/test_bzip2.dir/crctable.c.o [ 89%] Building C object plugins/CMakeFiles/test_bzip2.dir/randtable.c.o [ 90%] Building C object plugins/CMakeFiles/test_bzip2.dir/compress.c.o [ 92%] Building C object plugins/CMakeFiles/test_bzip2.dir/decompress.c.o [ 93%] Building C object plugins/CMakeFiles/test_bzip2.dir/bzlib.c.o [ 94%] Building C object plugins/CMakeFiles/test_bzip2.dir/H5Zbzip2.c.o /home/dogukan/c++/netcdf-cxx4-4.3.1/plugins/H5Zbzip2.c:6:10: fatal error: hdf5.h: No such file or directory 6 | #include | ^~~~ compilation terminated.

after I write "cmake ..", error occurs here.

Edit --- netCDF version is 4.6.2

WardF commented 4 years ago

What happens if you invoke it as follows:

$ cmake .. -DCMAKE_PREFIX_PATH=/usr

Do you see the same issue?

kandogu commented 4 years ago

It builds, however, this time it cannot pass ctest, all tests failed. Edit--- Sorry, it failed "make" command this time and It gives the same error.

kandogu commented 4 years ago

For more detailed information

$ cmake .. -DCMAKE_PREFIX_PATH=/usr -- Found bash: /usr/bin/bash -- HDF5: Using hdf5 compiler wrapper to determine C configuration NetCDF C Configuration Summary

General NetCDF Version: 4.3.1 Configured On: Çrş Şub 5 00:19:15 +03 2020 Host System: x86_64-Linux-5.3.0-29-generic Build Directory: /home/dogukan/c++/netcdf-cxx4-4.3.1/build Install Prefix:

Compiling Options C Compiler: /usr/bin/cc CFLAGS: -g -Wall -Wno-unused-variable -Wno-unused-parameter -g CPPFLAGS: -g -Wall -Wno-unused-variable -Wno-unused-parameter -g -Wall -Wconversion LDFLAGS: -Wl,--no-undefined AM_CFLAGS:
AM_CPPFLAGS:
AM_LDFLAGS:
Shared Library: yes Static Library: no Extra libraries:

-- Configuring done -- Generating done -- Build files have been written to: /home/dogukan/c++/netcdf-cxx4-4.3.1/build

$ make [ 35%] Built target netcdf-cxx4 [ 37%] Built target cxx4_test_var [ 40%] Built target cxx4_test_dim [ 42%] Built target cxx4_test_group [ 45%] Built target cxx4_test_att [ 48%] Built target cxx4_test_filter [ 50%] Built target cxx4_test_classic [ 53%] Built target cxx4_test_var2 [ 55%] Built target cxx4_test_type [ 58%] Built target cxx4_test_ncFile_Flags [ 61%] Built target cxx4_test_open_close [ 63%] Built target examples_simple_xy_rd [ 66%] Built target examples_simple_xy_wr [ 68%] Built target examples_pres_temp_4D_wr [ 71%] Built target examples_sfc_pres_temp_wr [ 74%] Built target examples_pres_temp_4D_rd [ 76%] Built target examples_sfc_pres_temp_rd [ 79%] Built target pres_temp_4D_plugin_rd [ 81%] Built target examples_simple_xy_wr_formats [ 84%] Built target pres_temp_4D_plugin_wr [ 85%] Building C object plugins/CMakeFiles/test_bzip2.dir/H5Zbzip2.c.o /home/dogukan/c++/netcdf-cxx4-4.3.1/plugins/H5Zbzip2.c:6:10: fatal error: hdf5.h: No such file or directory 6 | #include | ^~~~ compilation terminated.

WardF commented 4 years ago

Try this:

$ cmake .. -DCMAKE_CXX_FLAGS="-I /usr/include/hdf5/serial/"

Does that allow compilation to work?

kandogu commented 4 years ago

No, it gave the same error again.

fatal error: hdf5.h: No such file or directory
    6 | #include <hdf5.h>
      |          ^~~~~~~~
compilation terminated.
make[2]: *** [plugins/CMakeFiles/test_bzip2.dir/build.make:154: plugins/CMakeFiles/test_bzip2.dir/H5Zbzip2.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1833: plugins/CMakeFiles/test_bzip2.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
WardF commented 4 years ago

What happens if you try building with configure instead of cmake?

kandogu commented 4 years ago

I tried it and nothing changed, still giving the same error for $ make command. :(

WardF commented 4 years ago

Can you attach the config.log file generated when you ran configure? Thanks!

kandogu commented 4 years ago

Generated config log: config.log

atharris commented 3 years ago

I had the same issue on Ubuntu 18.04 running with WSL, and resolved it by changing the cmake call to:

cmake .. -DCMAKE_C_FLAGS="-I /usr/include/hdf5/serial/" -DCMAKE_PREFIX_PATH=/usr

I believe this is because the auto-generated make files in plugins/misc.dir use the C_INCLUDES variable rather than the CXX_INCLUDES variable.

niko-zvt commented 1 year ago

export CPATH="/path_to_libs/hdf5/include/"