geospace-code / h5fortran

Lightweight HDF5 polymorphic Fortran: h5write() h5read()
https://geospace-code.github.io/h5fortran
BSD 3-Clause "New" or "Revised" License
99 stars 24 forks source link

[Bug]: configure fails on Sonoma: `HDF5 C types failed check` #46

Closed barracuda156 closed 9 months ago

barracuda156 commented 1 year ago

What happened?

Configure fails on Sonoma. Ventura (also on aarch64) seems to be fine: https://build.macports.org/builders/ports-13_arm64-builder/builds/38986/steps/install-port/logs/stdio

Relevant log output

--->  Configuring h5fortran
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_fortran_h5fortran/h5fortran/work/build" && /opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=MacPorts -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_OBJC_COMPILER="$CC" -DCMAKE_OBJCXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules" -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON -DCMAKE_INSTALL_RPATH="/opt/local/lib" -Wno-dev -DBUILD_SHARED_LIBS=ON -Dh5fortran_BUILD_TESTING=ON -DHDF5_HAVE_PARALLEL=OFF -DPYTHON_EXECUTABLE=/opt/local/bin/python3.11 -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="14.0" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk" /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_fortran_h5fortran/h5fortran/work/h5fortran-4.10.3 
-- The C compiler identification is AppleClang 15.0.0.15000040
-- The Fortran compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether Fortran compiler has -isysroot
-- Checking whether Fortran compiler has -isysroot - yes
-- Checking whether Fortran compiler supports OSX deployment target flag
-- Checking whether Fortran compiler supports OSX deployment target flag - yes
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /opt/local/bin/gfortran-mp-13 - skipped
-- h5fortran 4.10.3 CMake 3.28.0-rc1 Toolchain 
-- checking that compilers can link together
-- checking that compilers can link together - OK
-- Performing Test HAVE_IEEE_ARITH
-- Performing Test HAVE_IEEE_ARITH - Success
-- Looking for H5_HAVE_FILTER_SZIP
-- Looking for H5_HAVE_FILTER_SZIP - found
-- Looking for H5_HAVE_FILTER_DEFLATE
-- Looking for H5_HAVE_FILTER_DEFLATE - found
-- Found ZLIB: /opt/local/lib/libz.dylib (found version "1.3")  
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test HDF5_C_links
-- Performing Test HDF5_C_links - Success
-- Performing Test HDF5_Fortran_links
-- Performing Test HDF5_Fortran_links - Success
-- Found HDF5: /opt/local/lib/libhdf5_hl.dylib;/opt/local/lib/libhdf5.dylib (found version "1.14.2") found components: Fortran 
-- Performing Test hdf5_c_types
-- Performing Test hdf5_c_types - Failed
CMake Error at cmake/CheckHDF5.cmake:42 (message):
  HDF5 C types failed check
Call Stack (most recent call first):
  cmake/CheckHDF5.cmake:96 (check_hdf5_c)
  CMakeLists.txt:49 (check_hdf5)

-- Configuring incomplete, errors occurred!
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_fortran_h5fortran/h5fortran/work/build" && /opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=MacPorts -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_OBJC_COMPILER="$CC" -DCMAKE_OBJCXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules" -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON -DCMAKE_INSTALL_RPATH="/opt/local/lib" -Wno-dev -DBUILD_SHARED_LIBS=ON -Dh5fortran_BUILD_TESTING=ON -DHDF5_HAVE_PARALLEL=OFF -DPYTHON_EXECUTABLE=/opt/local/bin/python3.11 -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="14.0" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk" /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_fortran_h5fortran/h5fortran/work/h5fortran-4.10.3 
Exit code: 1
barracuda156 commented 1 year ago

Also fails with LLVM clang-15:

-- The C compiler identification is Clang 15.0.7
-- The Fortran compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/local/bin/clang-mp-15 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether Fortran compiler has -isysroot
-- Checking whether Fortran compiler has -isysroot - yes
-- Checking whether Fortran compiler supports OSX deployment target flag
-- Checking whether Fortran compiler supports OSX deployment target flag - yes
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /opt/local/bin/gfortran-mp-13 - skipped
-- h5fortran 4.10.3 CMake 3.28.0-rc1 Toolchain 
-- checking that compilers can link together
-- checking that compilers can link together - OK
-- Performing Test HAVE_IEEE_ARITH
-- Performing Test HAVE_IEEE_ARITH - Success
-- Looking for H5_HAVE_FILTER_SZIP
-- Looking for H5_HAVE_FILTER_SZIP - found
-- Looking for H5_HAVE_FILTER_DEFLATE
-- Looking for H5_HAVE_FILTER_DEFLATE - found
-- Found ZLIB: /opt/local/lib/libz.dylib (found version "1.3")  
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test HDF5_C_links
-- Performing Test HDF5_C_links - Success
-- Performing Test HDF5_Fortran_links
-- Performing Test HDF5_Fortran_links - Success
-- Found HDF5: /opt/local/lib/libhdf5_hl.dylib;/opt/local/lib/libhdf5.dylib (found version "1.14.2") found components: Fortran 
-- Performing Test hdf5_c_types
-- Performing Test hdf5_c_types - Failed
CMake Error at cmake/CheckHDF5.cmake:42 (message):
  HDF5 C types failed check
Call Stack (most recent call first):
  cmake/CheckHDF5.cmake:96 (check_hdf5_c)
  CMakeLists.txt:49 (check_hdf5)
scivision commented 1 year ago

I wonder if this is a Macports packaging issue with the new Xcode 15 linker. I use similar AppleClang and Gfortran versions with Homebrew and don't have any issue.

I tried with CMake 3.27.7 and CMake 3.28.0-rc2

 cmake -Bbuild
-- The C compiler identification is AppleClang 15.0.0.15000040
-- The Fortran compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether Fortran compiler has -isysroot
-- Checking whether Fortran compiler has -isysroot - yes
-- Checking whether Fortran compiler supports OSX deployment target flag
-- Checking whether Fortran compiler supports OSX deployment target flag - yes
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /opt/homebrew/bin/gfortran - skipped
-- h5fortran 4.10.3 CMake 3.27.7 Toolchain 
-- Performing Test HAVE_IEEE_ARITH
-- Performing Test HAVE_IEEE_ARITH - Success
-- Looking for H5_HAVE_FILTER_SZIP
-- Looking for H5_HAVE_FILTER_SZIP - found
-- Looking for H5_HAVE_FILTER_DEFLATE
-- Looking for H5_HAVE_FILTER_DEFLATE - found
-- Looking for H5_HAVE_PARALLEL
-- Looking for H5_HAVE_PARALLEL - not found
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/lib/libz.tbd (found version "1.2.12")  
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test HDF5_C_links
-- Performing Test HDF5_C_links - Success
-- Performing Test HDF5_Fortran_links
-- Performing Test HDF5_Fortran_links - Success
-- Found HDF5: /opt/homebrew/Cellar/hdf5/1.14.2/lib/libhdf5_hl.dylib;/opt/homebrew/Cellar/hdf5/1.14.2/lib/libhdf5.dylib (found version "1.14.2") found components: Fortran 
scivision commented 1 year ago

If you look at ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeConfigureLog.yaml near the bottom you will probably see errors about unknown linker flags. If that is the case, a generic workaround currently needed by many project since Xcode 15 is:

export LDFLAGS="$LDFLAGS -Wl,-ld_classic"

You need a fresh build directory as LDFLAGS is only considered by CMake on the first project configure.

tsiayigong commented 1 year ago

Hi! When I try to build it on Ubuntu 20.04 via GNU GCC 13.2.0, I got a same error. Is there a solution? My cmake version is 3.27.7 and hdf5 version is 1.12.2.

cmake -B build -DCMAKE_PREFIX_PATH=/public/mathlib/hdf5/gcc/1.12.2 -DCMAKE_INSTALL_PREFIX=$HOME/test/111
-- The C compiler identification is GNU 13.2.0
-- The Fortran compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /public/compiler/gcc/13.2.0/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /public/compiler/gcc/13.2.0/bin/gfortran - skipped
-- h5fortran 4.10.4 CMake 3.27.7 Toolchain 
-- Performing Test HAVE_IEEE_ARITH
-- Performing Test HAVE_IEEE_ARITH - Success
-- Looking for H5_HAVE_FILTER_SZIP
-- Looking for H5_HAVE_FILTER_SZIP - not found
-- Looking for H5_HAVE_FILTER_DEFLATE
-- Looking for H5_HAVE_FILTER_DEFLATE - found
-- Looking for H5_HAVE_PARALLEL
-- Looking for H5_HAVE_PARALLEL - not found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.3")  
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Performing Test HDF5_C_links
-- Performing Test HDF5_C_links - Success
-- Performing Test HDF5_Fortran_links
-- Performing Test HDF5_Fortran_links - Success
-- Found HDF5: /public/mathlib/hdf5/gcc/1.12.2/lib/libhdf5_hl.so;/public/mathlib/hdf5/gcc/1.12.2/lib/libhdf5.so (found version "1.12.2") found components: Fortran 
-- Performing Test hdf5_c_types
-- Performing Test hdf5_c_types - Failed
CMake Error at cmake/CheckHDF5.cmake:42 (message):
  HDF5 C types failed check
Call Stack (most recent call first):
  cmake/CheckHDF5.cmake:96 (check_hdf5_c)
  CMakeLists.txt:43 (check_hdf5)

-- Configuring incomplete, errors occurred!
barracuda156 commented 1 year ago

@scivision Thank you, I will check the linker issue. It might be the case, since we had it with some other ports. However, given that Ubuntu is affected, according to the comment above, the problem may be elsewhere.

barracuda156 commented 1 year ago

The error only happens on Sonoma by the way: https://ports.macports.org/port/h5fortran/details Everything else builds fine (well, 10.6–10.7 x86 are broken on buildbots with Clangs, but everything 10.8+ builds – up to Ventura).

barracuda156 commented 1 year ago

4.10.4 still fails.

tsiayigong commented 1 year ago

In my attempt 4.10.3 can be complie with gfortran 13.2.0, however 4.10.4 can not.

barracuda156 commented 1 year ago

In my attempt 4.10.3 can be complie with gfortran 13.2.0, however 4.10.4 can not.

What error did you get? It worked for me with gcc13 (on 10.6).

Dave-Allured commented 10 months ago

The original issue is now RESOLVED for 4.10.4 on Macports. https://trac.macports.org/ticket/68499

I predict that this problem can also happen on Ventura when updated to Xcode 15, and older HDF5 fortran library builds.

If you are satisfied, please close this ticket.