缺少HDF5 C++库,如何解决?

Missing HDF5 C++ Library, How to solve?

提问人:Shuto 提问时间:10/28/2023 更新时间:10/28/2023 访问量:73

问:

我现在正在尝试运行一个名为 ViennaTS 的软件。(位于 /ViennaTS/build)

cmake ..

这产生了以下错误代码。

-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.46.0")
-- Found SPRNG: /home/ishitanaken23/sprng/lib/libsprng.a
-- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so;/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libcrypto.so;/usr/lib/x86_64-linux-gnu/libcurl.so;/usr/lib/x86_64-linux-gnu/libpthread.a;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.a;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.7") found components: CXX
CMake Error at CMakeLists.txt:69 (message):
  Missing HDF5 C++ library

电脑找不到 HDF5 C++ 库。 CMakeList.txt中HDF5的描述如下:找不到HDF5_hdf5_cpp_LIBRARY。

# HDF5
FIND_PACKAGE(HDF5 COMPONENTS CXX)
IF(HDF5_FOUND)
  IF(HDF5_hdf5_cpp_LIBRARY)
    add_definitions(-DUSE_HDF5)
    add_definitions(${HDF5_DEFINITIONS})
    INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIRS})
    SET(LIBRARIES ${LIBRARIES} ${HDF5_LIBRARIES})
  ELSE(HDF5_hdf5_cpp_LIBRARY)
    message(FATAL_ERROR "Missing HDF5 C++ library")
  ENDIF(HDF5_hdf5_cpp_LIBRARY)
ELSE(HDF5_FOUND)
  message(STATUS "Missing HDF5 library: ViennaTS will be built without TDR file support")
ENDIF(HDF5_FOUND)

如果您能帮助我找到解决方案,我将不胜感激。谢谢。

CMakeCache 对 HDF5 的描述如下。

//HDF5 CXX Wrapper compiler.  Used only to detect HDF5 compile
// flags.
HDF5_CXX_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5c++

//Path to a library.
HDF5_CXX_LIBRARY_crypto:FILEPATH=/usr/lib/x86_64-linux-gnu/libcrypto.so

//Path to a library.
HDF5_CXX_LIBRARY_curl:FILEPATH=/usr/lib/x86_64-linux-gnu/libcurl.so

//Path to a library.
HDF5_CXX_LIBRARY_dl:FILEPATH=/usr/lib/x86_64-linux-gnu/libdl.a

//Path to a library.
HDF5_CXX_LIBRARY_hdf5:FILEPATH=/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so

//Path to a library.
HDF5_CXX_LIBRARY_hdf5_cpp:FILEPATH=/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so

//Path to a library.
HDF5_CXX_LIBRARY_m:FILEPATH=/usr/lib/x86_64-linux-gnu/libm.so

//Path to a library.
HDF5_CXX_LIBRARY_pthread:FILEPATH=/usr/lib/x86_64-linux-gnu/libpthread.a

//Path to a library.
HDF5_CXX_LIBRARY_sz:FILEPATH=/usr/lib/x86_64-linux-gnu/libsz.so

//Path to a library.
HDF5_CXX_LIBRARY_z:FILEPATH=/usr/lib/x86_64-linux-gnu/libz.so

//HDF5 file differencing tool.
HDF5_DIFF_EXECUTABLE:FILEPATH=/usr/bin/h5diff

//The directory containing a CMake configuration file for HDF5.
HDF5_DIR:PATH=HDF5_DIR-NOTFOUND

文件(即 HDF5 C++ 库)的路径设置正确。

C++ Linux CMake 路径 HDF5

评论

0赞 Tsyvarev 10/28/2023
看起来您构建的项目期望将变量设置为 C++ HDF5 库的路径。但是 FindHDF5.cmake 脚本实际上设置了变量 。顺便说一句,他们在那里使用不同的 HDF5 库逻辑。FIND_PACKAGE(HDF5 COMPONENTS CXX)HDF5_hdf5_cpp_LIBRARYHDF5_CXX_LIBRARY_hdf5
0赞 Shuto 10/30/2023
@Tsyvarev,我通过将 CMakeList 中的 HDF5 描述部分替换为 ViennaTS-dev 的 CMakeList 中的 HDF5 部分来解决问题。谢谢。

答: 暂无答案