Geant4 Installation with HDF5


Geant4 Version: 11.1.1
Operating System: MacOS 13.3.1
Compiler/Version: Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Hey so I am trying to compile Geant4.11.1.1 with HDF5 and I am using this cmake command:

cmake -DCMAKE_PREFIX_PATH=/Users/diiego/software/hdf5_fromsource/CMake-hdf5-1.12.2 -DGEANT4_INSTALL_DATADIR=/Users/diiego/software/GEANT4/GEANT4_11.1/install/share/Geant4/data -DGEANT4_INSTALL_DATA=ON  -DGEANT4_USE_QT=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_HDF5=ON -DCMAKE_INSTALL_PREFIX=../install ../../GEANT4_11.1/geant4-v11.1.0

But it is returning this error:

CMake Error at /Applications/CMake.app/Contents/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find HDF5: (Required is at least version "1.8") (found
  HDF5_hdf5_LIBRARY-NOTFOUND)
Call Stack (most recent call first):
  /Applications/CMake.app/Contents/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:598 (_FPHSA_FAILURE_MESSAGE)
  /Applications/CMake.app/Contents/share/cmake-3.25/Modules/FindHDF5.cmake:1007 (find_package_handle_standard_args)
  cmake/Modules/G4OptionalComponents.cmake:351 (find_package)
  cmake/Modules/G4CMakeMain.cmake:59 (include)
  CMakeLists.txt:50 (include)

So I don’t know what I’m doing incorrectly, the hdf5 folder I am pointing to has the HDF5config.cmake file so I thought it would be correct.

Hope someone can help me, thanks in advance, Diego!

Could you post the list of files and directories that are present in this directory please?

Here!

CTestScript.cmake                 LIBAEC.tar.gz
FailedCTest.txt                   ZLib.tar.gz
HDF5-1.12.2-Darwin.dmg            build
HDF5-1.12.2-Darwin.sh             build-unix.sh
HDF5-1.12.2-Darwin.tar.gz         hdf5-1.12.2
HDF5Examples-1.12.9-Source.tar.gz hdf5.log
HDF5config.cmake                  hdf5_plugins-1_12_2.tar.gz
HDF5options.cmake

Thanks for the quick reply!

Thanks for the detail! How did you download/install HDF5? Though there is an HDF5Config.cmake present here, it doesn’t look related to any build/install - e.g. there’re no bin/lib/include directories or scripts I’d expect to see if HDF5 had been built here.

I followed this official documentation , basically doing this:

Quick Instructions
The quick instructions for building HDF5 with CMake are:
Download the CMake source code (CMake-hdf5-N.N.N.tar.gz or CMake-hdf5.N.N.N.zip).
Uncompress it.
From the command line, go in to the top CMake-hdf5-N.N.N directory and execute the build script  (build*) for your platform.
If you encounter any issues, then see the instructions below.

You are right there is no bin/lib/include directories. I also tried installing HDF5 using a version that allows executing a .configure and that’s all, but Geant4 wouldn’t compile either.

Thanks again :slight_smile:

Looking at the “Build Instructions” section and items 6/7, I think the “build” is actually of the packages:

HDF5-1.12.2-Darwin.dmg
HDF5-1.12.2-Darwin.sh
HDF5-1.12.2-Darwin.tar.gz

though it’s not mentioned those probably need to be unpacked/installed somewhere and that location will be where Geant4 needs to be pointed to find HDF5.

Hi again,

I executed the HDF5-1.12.2-Darwin.sh file and generated and actual installation.

Now I can see this inside a new folder:

bin     cmake   include lib     share

and inside the cmake folder I see this:

hdf5-config-version.cmake    hdf5-targets.cmake           libaec-targets-release.cmake zlib-config.cmake
hdf5-config.cmake            libaec-config-version.cmake  libaec-targets.cmake         zlib-targets-release.cmake
hdf5-targets-release.cmake   libaec-config.cmake          zlib-config-version.cmake    zlib-targets.cmake

Then I try to install Geant4 with this instructions:

cmake -DCMAKE_PREFIX_PATH=/Users/diiego/software/hdf5_fromsource/CMake-hdf5-1.12.2/HDF5-1.12.2-Darwin/HDF_Group/HDF5/1.12.2/cmake -DCMAKE_PREFIX_PATH=/opt/homebrew/Cellar/qt@5/5.15.8_2/lib/cmake -DGEANT4_INSTALL_DATADIR=/Users/diiego/software/GEANT4/GEANT4_11.1/install/share/Geant4/data -DGEANT4_INSTALL_DATA=ON  -DGEANT4_USE_QT=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_HDF5=ON -DCMAKE_INSTALL_PREFIX=../install ../../GEANT4_11.1/geant4-v11.1.0

But it fails:

-- The C compiler identification is AppleClang 14.0.3.14030022
-- The CXX compiler identification is AppleClang 14.0.3.14030022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/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: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Checking C++ feature CXXSTDLIB_FILESYSTEM_NATIVE - Success
-- Performing Test HAVE_TLS
-- Performing Test HAVE_TLS - Success
-- Found EXPAT: /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/lib/libexpat.tbd (found version "2.5.0")
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find HDF5: (Required is at least version "1.8") (found
  HDF5_hdf5_LIBRARY-NOTFOUND)
Call Stack (most recent call first):
  /Applications/CMake.app/Contents/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:598 (_FPHSA_FAILURE_MESSAGE)
  /Applications/CMake.app/Contents/share/cmake-3.25/Modules/FindHDF5.cmake:1007 (find_package_handle_standard_args)
  cmake/Modules/G4OptionalComponents.cmake:351 (find_package)
  cmake/Modules/G4CMakeMain.cmake:59 (include)
  CMakeLists.txt:50 (include)

I tried giving Geant4 the path to the “hole” installation folder and to lib too, and it does not work.

Thanks again, Diego

I think the appropriate path to use for HDF5 is /Users/diiego/software/hdf5_fromsource/CMake-hdf5-1.12.2/HDF5-1.12.2-Darwin/HDF_Group/HDF5/1.12.2/ as the cmake isn’t needed with CMAKE_PREFIX_PATH.

Also, whilst I’m not sure exactly how CMake treats two or more repitions of -DCMAKE_PREFIX_PATH, it’s probably better to combine these as a semi-colong separated list, e.g.

cmake -DCMAKE_PREFIX_PATH="/Users/diiego/software/hdf5_fromsource/CMake-hdf5-1.12.2/HDF5-1.12.2-Darwin/HDF_Group/HDF5/1.12.2/;/opt/homebrew/Cellar/qt@5/" ...

That worked! Thank you so much!

Diego

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.