Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmake] Fix configuration with Geant4 11.1 #267

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

hahnjo
Copy link
Contributor

@hahnjo hahnjo commented Oct 20, 2023

When trying to configure with Geant4 11.1, G4HepEm seems to have problems finding Geant4 even though AdePT's correctly found it before. As a reason, CMake quotes not finding XercesC even though both Vecgeom and Geant4 (searched from AdePT) find it. It seems explicitly looking for XercesC solves the problem (not sure why).

When trying to configure with Geant4 11.1, G4HepEm seems to have
problems finding Geant4 even though AdePT's correctly found it
before. As a reason, CMake quotes not finding XercesC even though
both Vecgeom and Geant4 (searched from AdePT) find it. It seems
explicitly looking for XercesC solves the problem (not sure why).
@hahnjo
Copy link
Contributor Author

hahnjo commented Oct 20, 2023

@agheata @JuanGonzalezCaminero which version of Geant4 are you using, are you also facing errors like

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Failed to find XercesC (missing: XercesC_INCLUDE_DIR) (found suitable
  version "3.2.3", minimum required is "3.2.3")
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindXercesC.cmake:110 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  /usr/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /home/jhahnfel/Geant4/geant4-11.1-release/install-v11.1.2/lib64/cmake/Geant4/Geant4Config.cmake:311 (find_dependency)                                                                                
  external/g4hepem/CMakeLists.txt:58 (find_package)

with Geant4 11.1 (version 11.0 seems to work fine)?

cc @drbenmorgan as well

@phsft-bot
Copy link

Can one of the admins verify this patch?

@drbenmorgan
Copy link
Member

@hahnjo also which CMake version are you running? Just wondering if this is related to the changes in 3.27 that broke the finding of EXPAT. Do you have a /home/jhahnfel/Geant4/geant4-11.1-release/install-v11.1.2/lib64/cmake/Geant4/Geant4PackageCache.cmake file, and if so could you post it here (or just any lines related to XercesC) please?

I'll fire up things locally as well, though likely won't have time until Monday.

@agheata
Copy link
Contributor

agheata commented Oct 20, 2023

@agheata @JuanGonzalezCaminero which version of Geant4 are you using, are you also facing errors like

I'm on 11.0 and don't see this

@hahnjo
Copy link
Contributor Author

hahnjo commented Oct 20, 2023

@hahnjo also which CMake version are you running?

cmake version 3.20.2

(from AlmaLinux 8)

Just wondering if this is related to the changes in 3.27 that broke the finding of EXPAT. Do you have a /home/jhahnfel/Geant4/geant4-11.1-release/install-v11.1.2/lib64/cmake/Geant4/Geant4PackageCache.cmake file, and if so could you post it here (or just any lines related to XercesC) please?

Yes, that file exists. The relevant lines are

# XercesC Build Time Settings
geant4_set_and_check_package_variable(XercesC_INCLUDE_DIR "/usr/include" PATH "Xerces-C++ include directory")
geant4_set_and_check_package_variable(XercesC_LIBRARY_RELEASE "/usr/lib64/libxerces-c.so" FILEPATH "Xerces-C++ libraries (release)")

which looks reasonable to me, and is the same as in /home/jhahnfel/Geant4/geant4-11.0-release/install-v11.0.2/lib64/Geant4-11.0.2/Geant4PackageCache.cmake for Geant4 11.0 that works just fine. The only diff between the CMake files of the two installations related to XercesC is bumping the version to from 3.2.2 to 3.2.3, which is exactly the version I have installed.

I'll fire up things locally as well, though likely won't have time until Monday.

Thanks! Not really urgent for now, was just trying to update my local build...

@drbenmorgan
Copy link
Member

Thanks @hahnjo, those lines indeed look fine. It might be something to do with the version - you could try hacking deleting the Xerces-C version that Geant4Config.cmake adds:

# - GDML
set(Geant4_gdml_FOUND ON)
if(Geant4_gdml_FOUND)
  find_dependency(XercesC 3.2.4)
endif()

to

# - GDML
set(Geant4_gdml_FOUND ON)
if(Geant4_gdml_FOUND)
  find_dependency(XercesC)
endif()

and seeing if that resolves things. I'll have a look in any case as there's something weird going on.

@hahnjo
Copy link
Contributor Author

hahnjo commented Oct 20, 2023

@drbenmorgan no luck, only changed the error message to

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):                                                                                                              
  Failed to find XercesC (missing: XercesC_INCLUDE_DIR) (found version                                                                                                                                  
  "3.2.3")

ie not mentioning minimum required is "3.2.3" anymore...

@drbenmorgan
Copy link
Member

I've managed to reproduce this locally, albeit using the master of VecGeom - @hahnjo, which VecGeom commit/tag are you using, or more specifically, does the VecGeomConfig.cmake file picked up have the lines:

if(NOT DEFINED VecCore_DIR)
   set(VecCore_DIR "/.../lib64/cmake/VecCore")
endif()
if(NOT DEFINED XercesC_INCLUDE_DIR)
  set(XercesC_INCLUDE_DIR "/.../include")
endif()

with ... being whatever prefix those are installed under? It's these that seem to affect behaviour/contend with Geant4 11.1, but wanted to cross-check.

@hahnjo
Copy link
Contributor Author

hahnjo commented Oct 26, 2023

@drbenmorgan yes, I'm using (approximately) VecGeom master as this is now required since recently. VecGeomConfig.cmake has the following lines:

if(NOT DEFINED XercesC_INCLUDE_DIR)
  set(XercesC_INCLUDE_DIR "/usr/include")
endif()

And just for completeness, Geant4 is not built against any VecGeom.

@drbenmorgan
Copy link
Member

Thanks! Same here, "pure" Geant4 without VecGeom, and for reference, same CMake version (3.20.2, Rocky Linux 9).

Copy link
Contributor

@WitekPokorski WitekPokorski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, people still have this problem and this fix solves it, so I am approving it.

@WitekPokorski WitekPokorski merged commit 3e2c976 into apt-sim:master Jan 19, 2024
2 checks passed
@hahnjo hahnjo deleted the geant4-11.1 branch January 19, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants