Expat bug for installing geant4 with lastest Xcode 15.0

_Geant4 Version:11.1.2
_Operating System:macos 11.2
_Compiler/Version: Xcode 15.0
_CMake Version: cmake version 3.27.5

Hi all,
I just upgrade to Xcode 15.0, it has a bug when using geant4 with expat.
If set use_system_expat=OFF
building geant4 with bug

[ 0%] Building C object source/externals/expat/CMakeFiles/G4expat.dir/src/xmlrole.c.o  
/Users/test/software/Geant4/g4/geant4-v11.1.2/source/externals/expat/src/xmlparse.c:127:4: error: You do not have support for any sources of high quality entropy enabled. For end user security, that is probably not what you want. Your options include: * Linux >=3.17 + glibc >=2.25 (getrandom): HAVE_GETRANDOM, * Linux >=3.17 + glibc (including <2.25) (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, * BSD / macOS >=10.7 (arc4random_buf): HAVE_ARC4RANDOM_BUF, * BSD / macOS (including <10.7) (arc4random): HAVE_ARC4RANDOM, * libbsd (arc4random_buf): HAVE_ARC4RANDOM_BUF + HAVE_LIBBSD, * libbsd (arc4random): HAVE_ARC4RANDOM + HAVE_LIBBSD, * Linux (including <3.17) / BSD / macOS (including <10.7) / Solaris >=8 (/dev/urandom): XML_DEV_URANDOM, * Windows >=Vista (rand_s): _WIN32. If insist on not using any of these, bypass this error by defining XML_POOR_ENTROPY; you have been warned. If you have reasons to patch this detection code away or need changes to the build system, please open a bug. Thank you!  
# error You do not have support for any sources of high quality entropy \  
^  
1 error generated.

So I try to use G4 with system expat
but after installing
the file

~/software/Geant4/install/lib/cmake/Geant4/Geant4PackageCache.cmake

EXPAT_LIBRARY : show nothing.

# EXPAT Build Time Settings  
geant4_set_and_check_package_variable(EXPAT_INCLUDE_DIR "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include" PATH "Path to a file.")  
geant4_set_and_check_package_variable(EXPAT_LIBRARY "" "")

when trying to build with example/basic/b2

CMake Error at 
~/software/Geant4/install/lib/cmake/Geant4/Geant4PackageCache.cmake:19 (geant4_set_and_check_package_variable):  
geant4_set_and_check_package_variable Macro invoked with incorrect  
arguments for macro named: geant4_set_and_check_package_variable  
Call Stack (most recent call first):  
~/software/Geant4/install/lib/cmake/Geant4/Geant4Config.cmake:254 (include)  
B2b/CMakeLists.txt:14 (find_package)

however I try to set

geant4_set_and_check_package_variable(EXPAT_LIBRARY "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/lib/libexpat.tbd" FILEPATH "Path to a file.")

when trying to build with example B2
still with bug.

than I’ve try to install the expat with homebrew
and modify

geant4_set_and_check_package_variable(EXPAT_LIBRARY "/opt/homebrew/lib/libexpat.dylib" FILEPATH "Path to a file.")

finally it works.

1 Like

Thanks for the report - I’ll take a look as soon as I have done the update to Xcode locally.

On the Geant4PackageCache.cmake, please see 2556 – Changes to FindEXPAT in CMake 3.27 break Geant4PackageCache.cmake file You’ve done one of the possible fixes, but as you’re using Homebrew, you may just want to delete the Geant4PackageCache.cmake file in the installation. It isn’t needed when system/package manager libraries are used and it’s totally safe to delete the file.

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