Enabling GDML on Windows

Hi All. I’m attempting to build geant4-v11.3.0 with GDML following previous questions Geant4 installation options on Windows.
I follow the methodology suggested by weller. However, Xerces-C still cannot be found.

CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Failed to find XercesC (missing: XercesC_LIBRARY XercesC_INCLUDE_DIR
  XercesC_VERSION) (Required is at least version "3.3.0")

I can see that the GDML headers have been built and the CmakeCache shows the following messages relating to the inclusion of XercesC.

 //No help, variable specified on the command line.
CMAKE_PREFIX_PATH:UNINITIALIZED=C:\Program Files\xercesc\xerces-c-3.3.0-install
...
//Xerces-C++ include directory
XercesC_INCLUDE_DIR:PATH=C:/Program Files/xercesc/xerces-c-3.3.0-install/include

//Xerces-C++ libraries (debug)
XercesC_LIBRARY_DEBUG:FILEPATH=XercesC_LIBRARY_DEBUG-NOTFOUND

//Xerces-C++ libraries (release)
XercesC_LIBRARY_RELEASE:FILEPATH=C:/Program Files/xercesc/xerces-c-3.3.0-install/lib/xerces-c_3.lib

I have previously built Geant4 and had this working without GDML, but have then attempted to rebuild this with GDML and get this issue. I can recover Geant4 without GDML. How can I correctly build the GDML tools?

See details of my build below.
Thanks in advance,
Joe Crone

XercesC has been installed at C:\Program Files\xercesc\xerces-c-3.3.0-install following the instructions Build Instructions and configured for the windows build, with

cmake -DCMAKE_INSTALL_PREFIX="C:\Program Files\xercesc\xerces-c-3.3.0-install" "C:\Program Files\xercesc\xerces-c-3.3.0"
cmake --build . --config Debug
cmake --build . --config Debug --target install

Then in the Geant4 build I have used the standard build as described in https:;;geant4-userdoc.web.cern.ch;UsersGuides;InstallationGuide;html;installguide.html#on-windows-platforms.
(Apologies, using semi-colons instead of slashes in links because of forum limits for new users)
However, I have used the configuration

cmake <standard> -DCMAKE_PREFIX_PATH="C:\Program Files\xercesc\xerces-c-3.3.0-install" -DGEANT4_USE_GDML=ON "C:\Program Files\Geant4\geant4-v11.3.0"
cmake --build . --config Release
cmake --build . --config Release --target install

_Geant4 Version:v11.3.0
_Operating System:Windows 11
_Compiler/Version:MSVC 14.42
_CMake Version:3.30.5-msvc23


Hello Joe,

I tried your CMake command and CMake found the Xerces library correctly.
You can also try to add the “C:\Program Files\xercesc\xerces-c-3.3.0-install\bin” to your path. In this way, it is not necessary to use the -DCMAKE_PREFIX_PATH.

On Windows, I also recommend using the CMake GUI. Here you can see if the library and headers are found, and if not, you can set them manually.

Andrea

Hi Andrea,

Thanks for checking this out. I have also attempted to replicate this on a different windows 10 PC which also fails in the same way. xerces-c-3.3.0 has been added to path (system environment variable) in both cases. I will try to configure this using the cmake GUI and without using -DCMAKE_PREFIX_PATH and see if this gives me a different result.

Joe

Thanks Andrea,

This I have built Geant4 with the cmake GUI and this builds identically to the command line version above. I can re-build my projects but I have to specify

-DCMAKE_INSTALL_PREFIX="<path/to/xerces-c>

on every configuration command for the projects i.e. xerces-c is not found unless I point cmake to it.
Is there a way to avoid this?

Joe

This doesn’t work for any project in which Xerces-C++ is used. When trying to use the GDMLParser I get the following system error.

The system error does not pop up until the code is executed. The configuration and build steps proceed fine. The file xerces-c-3_3.dll is present in xercesc/xerces-c-3.3.0-install/bin.

How can I avoid this error?

Joe

I have also attempted to build Geant4 with GDML with respect to the tutorial at https://www.youtube.com/watch?v=rU4Ps3pHdIc on two different PCs. Again, XercesC is not found when configuring projects unless

-DCMAKE_INSTALL_PREFIX="<path/to/xerces-c>"

is used (the path is now C:\Program Files\xerces-c). This then configures and builds but upon execution gives the same system error as in my previous post.

Joe

That dll isnt in your windows path. You need to look into how to add it.