(All followed by cmake --build . --clean-first -j$(nproc) --config Release -v)
Now some appear to have built successfully but pHDF5 for me is just a dependency for another application. When I try to compile this other application, it reports CMake Error at /path/to/hdf5/cmake/hdf5-config.cmake: include could not find requested file: /path/to/hdf5/cmake/zlib-targets.cmake. Which, to me, seems like zlib isn’t actually building. Am I understanding correctly? Why isn’t this file present (am I missing a flag)?
Not answering question, but libaec is the open replacement for szip - using both could cause issues.
In INSTALL_CMake.txt file there are multiple ways to build HDF5 with various methods of zlib/libaec. Also check the config/cmake/cacheinit.cmake file for hints - it is the file we use to build binaries. (I prefere the tgz method, and there are examples in our CI workflows).
@byrn when I tried to install with szip only the log kept reporting that libaec was missing so I figured I’d just give it both and see what happened. How can I have cmake ignore one or the other and which would you recommend?
Also thank you for pointing out INSTALL_CMake.txt, that is super helpful - I’ve been enumerating flags by searching forum posts and knew there had to be a better way.
@hyoklee Sorry, they were already uploaded but the markdown formatting was wrong and I couldn’t initially edit the post once I created it (it’s fixed now)
also: Linux <hostname>.com 4.18.0-553.5.1.el8_10.x86_64 #1 SMP Tue May 21 03:13:04 EDT 2024 x86_64 x86_64 x86_64 GNU/Linux
@byrn@hyoklee Interestingly I found this in hdf5-config.cmake:
#-----------------------------------------------------------------------------
# Don't include targets if this file is being picked up by another
# project which has already built hdf5 as a subproject
#-----------------------------------------------------------------------------
if (NOT TARGET "hdf5")
if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
include (${PACKAGE_PREFIX_DIR}/cmake/zlib-targets.cmake)
endif ()
if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
include (${PACKAGE_PREFIX_DIR}/cmake/libaec-targets.cmake)
endif ()
include (${PACKAGE_PREFIX_DIR}/cmake/hdf5-targets.cmake)
endif ()
But I’m not sure how to interpret it exactly. Since I’m currently compiling HDF5 not via a some subproject, shouldn’t these targets be being built?
@byrn Right so shouldn’t the targets be built? I guess that’s why I’m confused how/why cmake finds libaec and zlib but doesn’t generate the targets:
-- Filter ZLIB file is /
-- Filter SZIP file is /
-- Filter HDF5_ZLIB package name:zlib
-- Found ZLIB: /home/n06174/software/hdf5-1.14.6/zlib-1.3.1/zlib/lib/libz.so.1.3.1 (found version "1.3.1")
-- Filter HDF5_ZLIB is ON
-- H5_ZLIB_HEADER=zlib.h
-- Found libaec: /home/n06174/software/hdf5-1.14.6/libaec-v1.1.3/libaec/cmake/libaec-config.cmake (found version "1.1.3")
-- H5_SZIP_FOUND=TRUE and LINK_COMP_LIBS=ZLIB::ZLIB;libaec::sz;libaec::aec
-- LINK_COMP_LIBS=ZLIB::ZLIB;libaec::sz;libaec::aec
-- Filter SZIP is ON
-- H5_ZLIB_HEADER for library=zlib.h
-- H5_ZLIB_HEADER=zlib.h
-- H5_ZLIB_HEADER for direct_chunk=zlib.h
-- H5_ZLIB_HEADER for zip_perf=zlib.h
-- HDF5 Example H5EX_RESOURCES_DIR: /home/n06174/software/hdf5-1.14.6/config/cmake
-- HDF5 H5_LIBVER_DIR: 114 HDF5_API_VERSION: v114
-- HDF5 Example link libs: hdf5-shared;hdf5_hl-shared Includes: /home/n06174/software/hdf5-1.14.6/src;/home/n06174/software/hdf5-1.14.6/src/H5FDsubfiling;/home/n06174/software/hdf5-1.14.6/build/src;/home/n06174/software/hdf5-1.14.6/hl/src;/home/n06174/software/hdf5-1.14.6/build/hl/src
-- HDF5 link libs: hdf5-shared;hdf5_hl-shared
@byrn Why is that? That doesn’t make a whole lot of sense to me (I thought that was the point of HDF5_PACKAGE_EXTLIBS). If an external project wants to reference HDF5 instance then how can it do that without building those targets?
-- Filter ZLIB file is /home/n06174/software/hdf5-1.14.6/zlib-1.3.1.tar.gz
-- Filter SZIP file is /home/n06174/software/hdf5-1.14.6/libaec-v1.1.3.tar.gz
-- Filter ZLIB file /home/n06174/software/hdf5-1.14.6/zlib-1.3.1.tar.gz
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Final: share
CMake Error at config/cmake/HDFLibMacros.cmake:40 (add_library):
add_library cannot create ALIAS target "zlib-static" because another target
with the same name already exists.
Call Stack (most recent call first):
CMakeFilters.cmake:140 (EXTERNAL_ZLIB_LIBRARY)
CMakeLists.txt:921 (include)
-- Filter HDF5_ZLIB is built
CMake Warning at CMakeFilters.cmake:163 (message):
ZLib support in HDF5 was enabled but not found
Call Stack (most recent call first):
CMakeLists.txt:921 (include)
-- H5_ZLIB_HEADER=
-- Filter SZIP file /home/n06174/software/hdf5-1.14.6/libaec-v1.1.3.tar.gz
-- Performing Test HAVE_DECL___BUILTIN_CLZLL
-- Performing Test HAVE_DECL___BUILTIN_CLZLL - Success
-- Looking for snprintf
-- Looking for snprintf - found
-- Final: share
CMake Error at config/cmake/HDFLibMacros.cmake:78 (add_library):
add_library cannot create ALIAS target "szaec-static" because another
target with the same name already exists.
Call Stack (most recent call first):
CMakeFilters.cmake:200 (EXTERNAL_SZIP_LIBRARY)
CMakeLists.txt:921 (include)
-- Filter SZIP is built using library AEC
-- LINK_COMP_LIBS=
CMake Warning at CMakeFilters.cmake:221 (message):
SZIP support in HDF5 was enabled but not found
Call Stack (most recent call first):
CMakeLists.txt:921 (include)
CMake Error at utils/subfiling_vfd/CMakeLists.txt:8 (file):
file COPY given no DESTINATION
-- HDF5 Example H5EX_RESOURCES_DIR: /home/n06174/software/hdf5-1.14.6/config/cmake
-- HDF5 H5_LIBVER_DIR: 114 HDF5_API_VERSION: v114
-- HDF5 Example link libs: hdf5-shared;hdf5_hl-shared Includes: /home/n06174/software/hdf5-1.14.6/src;/home/n06174/software/hdf5-1.14.6/src/H5FDsubfiling;/home/n06174/software/hdf5-1.14.6/build/src;/home/n06174/software/hdf5-1.14.6/hl/src;/home/n06174/software/hdf5-1.14.6/build/hl/src
-- HDF5 link libs: hdf5-shared;hdf5_hl-shared
-- HDF5 H5_LIBVER_DIR: 114 HDF5_VERSION_MAJOR: 1.14
-- Configuring incomplete, errors occurred!
Because it does not always have the details that are available when building it in-line. So we can’t create extra info needed for packaging other than creating a dependency.
As far as the configure error - I don’t know why because the options look correct. The target names should not be used anywhere else. I can only suggest maybe inspecting the CI workflows for some clues.
Well this double print is certainly fishy to me for zlib (however thats not very insightful for the same failure that szip endures).
What exactly do you mean by CI workflows? Is there any other information I can provide that would help in debugging? I’m afraid I’m not actually very good with CMake.
So I had much more luck just avoiding cmake altogether and building with regular make:
../configure CC=`which $CC` CXX=`which $CXX` FC=`which $FC` \
CFLAGS='-diag-disable=10441' CXXFLAGS='-diag-disable=10441' FCFLAGS='-diag-disable=10441' \
--enable-parallel --enable-fortran \
--with-zlib=`realpath ../zlib-1.3.1/zlib` --with-szlib=`realpath ../szip-2.1.1/szip` --prefix=`realpath ../hdf5` && \
make all -j1 && \
make install
Admittedly, its still not clear to how to point configure to libaec instead of szip (since configure reported that it could not find libaec when I just drop-in replaced the root dir for the libaec instance against the szip flag. Not even sure if I need szip anyway and at least I have still have zlib.
For CMake (no parallel and build compression libs inline) you could just try using:
“cmake --workflow --preset ci-StdShar-gcc --fresh”
This would give you a starting point to create a CMakeUsers.json file to customize. (See the develop doxygen for the Presets Cookbook)