Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please clarify H5Free #151

Open
VictorEijkhout opened this issue Apr 5, 2024 · 5 comments
Open

Please clarify H5Free #151

VictorEijkhout opened this issue Apr 5, 2024 · 5 comments

Comments

@VictorEijkhout
Copy link

-- Plugin support requires libhdf5 with H5Free support. Your libhdf5 install does not provide H5Free.  Please install a newer version of libhdf5 if you require plugin compression support.
  1. I'm not requesting plugin compression support:
cmake -D CMAKE_INSTALL_PREFIX=/work2/00434/eijkhout/netcdf/installation-netcdf-4.9.2-stampede3-intel24                     
-D CMAKE_COLOR_DIAGNOSTICS=OFF                     
-D CMAKE_VERBOSE_MAKEFILE=ON                     
-D BUILD_SHARED_LIBS=ON                     
-DNCDIR=/work2/00434/eijkhout/netcdf/installation-netcdf-4.9.2-stampede3-intel24 
-DnetCDF_LIBRARIES=/work2/00434/eijkhout/netcdf/installation-netcdf-4.9.2-stampede3-intel24/lib64/libnetcdf.so 
-DnetCDF_INCLUDE_DIR=/work2/00434/eijkhout/netcdf/installation-netcdf-4.9.2-stampede3-intel24/include                       
/work2/00434/eijkhout/netcdfx/netcdfx-4.3.1/
  1. What option for netcdf-c do I need?

Victor.

@WardF
Copy link
Member

WardF commented Apr 5, 2024

You should be able to pass -DENABLE_PLUGINS=OFF to turn this off.

@VictorEijkhout
Copy link
Author

That option applied to? 1. hdf5 2. netcdf-c 3. netcdf-cxx?

@VictorEijkhout
Copy link
Author

VictorEijkhout commented Apr 6, 2024

Actually, that error was caused by:

CMake Error at CMakeLists.txt:405 (CHECK_LIBRARY_EXISTS):
  CHECK_LIBRARY_EXISTS Macro invoked with incorrect arguments for macro
  named: CHECK_LIBRARY_EXISTS

which comes from:

CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5free_memory "" HAVE_H5FREE_MEMORY)

so apparently that variable is null. Ok, that's a bizarre looking variable, so I define it by hand:

    -D HDF5_C_LIBRARY_hdf5=${TACC_HDF5_LIB}/libhdf5.so 

Why do I have to do this? hdf5 has both .pc and .cmake files but this does not look like a normal naming convention.

Now all that remains is finding the hdf5 include files.

@VictorEijkhout
Copy link
Author

And the solution seems to be:

    -D netCDF_INCLUDE_DIR='${TACC_NETCDF_INC};${TACC_HDF5_INC}'

@truenicfel
Copy link
Contributor

truenicfel commented Jan 10, 2025

I had the same issue today trying to build on my windows machine. I was not able to get it to work in the end. It build but it did not run. My feeling is that especially the MSVC cmake configuration of netcdf-cxx4 is quite broken.

First thing I found was here:

IF(MSVC)
SET(SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME})
FIND_PACKAGE(HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS C HL NO_MODULES REQUIRED ${NC_HDF5_LINK_TYPE})
ELSE(MSVC)
FIND_PACKAGE(HDF5 COMPONENTS C HL REQUIRED)
ENDIF(MSVC)

The MSVC section of the if does not work since HDF5_PACKAGE_NAME is empty. CMake therefore tries to search for hdf using an empty name, cant find it and then the CHECK_LIBARARY_EXISTS macro fails a few lines later. Simply using FIND_PACKAGE(HDF5 COMPONENTS C HL REQUIRED) did the trick for me and I was able to progress. This also removed the H5Free problem described in the original issue. I believe that the error was simply the result of it not being able to find the package at all.

When trying to build the examples. I got a strange error that zlib is required but the file C:/share/VS15/x64/lib/zlib.lib does not exist. This did not look right to me as this path does not exist on my system. So I tracked down the problem and found that the netcdf 4.9.2 installation comes with this error built in. In line 58

INTERFACE_LINK_LIBRARIES "hdf5-shared;hdf5_hl-shared;C:/share/VS15/x64/lib/zlib.lib;C:/share/VS15/x64/lib/libcurl_imp.lib"

someone managed to ship their personal system paths into the config file that is supposed to help with including netcdf in your cmake project. So I changed that to:

INTERFACE_LINK_LIBRARIES "hdf5-shared;hdf5_hl-shared;C:/share/VS15/x64/lib/zlib.lib;C:/share/VS15/x64/lib/libcurl_imp.lib"

and I was a step further. But the next error was already waiting to emerge. Now the tests were not able to link netcdf-cxx's own library. I tried removing the BUILD_SHARED_LIBS which worked for compiling but I feel like it caused issues when running the tests as all my tests failed. because apparently my netcdf installation does not support these features which I highly doubt as not even the simple surface pressure example in this repo is running.

I am not sure why all of these things are not an issue on my linux system but I assume that is because zlib, hdf5 and other dependencies are not bundled there but instead installed separately via package managers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants