The install of geant4-v11.2.0.beta

Geant4 Version: geant4-v11.2.0.beta
Operating System: ubuntu

cmake 27
after the successful installation of g4, i start to run the example of B1 but i meet a problem

i dot know how to fix it

Could you post the Geant4PackageCache.cmake file listed in the error file here please?

For future posts, please do not use screenshots to post terminal output as this makes reviewing and helping with the problem (e.g. copying file paths like here) much harder. See our guide post on How to post code snippets for the use of text fenced code blocks.

Do you mean CMake 3.27? I think there’s a bug in the generation of the Geant4PackageCache.cmake caused by changes in that version, so just wanted to confirm!

Today, I browsed the home page of G4 and found that the compiler required for GEANT4_11.1.2 is version gcc 8.5, but mine is version 8.3. Therefore, I believe it may be an issue with the compiler version. I am upgrading gcc and will report the results in the future.

It should be o.k. to use 8.3, but doesn’t hurt to upgrade. However, I can almost guarantee this won’t solve the issue which is due to a change in how CMake 3.27 locates the Expat dependency. If you still see the issue after the compiler upgrade, there are several ways to proceed:

  1. If Geant4 is already installed and you don’t want to reinstall
    • Remove the Geant4PackageCache.cmake file. It’s an optional file, and removing it won’t break the installation. However, if Geant4 was built with dependencies (EXPAT, ZLIB, CLHEP, Xerces-C, Qt etc) in locations not known to CMake, then these paths must be added to CMAKE_PREFIX_PATH (See the CMake documentation for further info onto). I suspect on Ubuntu these will all be coming from the standard system locations though.
  2. If you’re o.k. reinstalling, you can either:
    • Run cmake -DGEANT4_INSTALL_PACKAGE_CACHE=OFF <otherargs> to prevent install of the file in the first place.
    • or, Run cmake -DGEANT4_USE_SYSTEM_EXPAT=OFF <otherargs> to use the builtin expat and sidestep the bug.

Dear bmorgan,thanks for your reply. the thing happens as what you have expected. after i upgraded the compiler, the mistake still existed. so i preformed the reinstalling with the line : DGEANT4_INSTALL_PACKAGE_CACHE=OFF,and i succeeded lately after these steps.

i am confused with the issue , and i wonder that if i should change the version of CMAKE and try to fix the issue again.

the ubuntu version of my workstation is 19.10
thanks !

The issue is down to changes in CMake’s FindEXPAT module as outlined here: 2556 – Changes to FindEXPAT in CMake 3.27 break Geant4PackageCache.cmake file

If you’ve got things working with -DGEANT4_INSTALL_PACKAGE_CACHE=OFF in the install of Geant4, then that’s fine and there shouldn’t be further issues using CMake 3.27.

thanks for your reply! i intend to do future research based on your advice.


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