Example B1 execution

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:_11.1.1
_Operating System:_Linux / UNIX
_CMake Version:_3.26


Hi All, Our lab installed a new version of Fedora (version 37) last month and I installed Geant4-v11.1.1 on it. I tried to execute example B1 from the basic folder, which I was able to do when I had the older version of Fedora. This time, cmake is giving me this error:
CMake Error at /mnt/Software/Geant4/geant4-v11.1.1-install/lib64/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):

/mnt/Software/Geant4/geant4-v11.1.1-install/lib64/cmake/Geant4/Geant4Config.cmake:254 (include)
CMakeLists.txt:13 (find_package)

– Found EXPAT: /usr/lib64/libexpat.so (found suitable version “2.5.0”, minimum required is “2.5.0”)
– Performing Test CMAKE_HAVE_LIBC_PTHREAD
– Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
– Found Threads: TRUE
– Found Geant4: /mnt/Software/Geant4/geant4-v11.1.1-install/lib64/cmake/Geant4/Geant4Config.cmake (found version “11.1.1”)
– Configuring incomplete, errors occurred!

Please help, thanks!

This is usually symptomatic of the underlying system and paths hardcoded in the Geant4PackageCache.cmake file changing. However the “incorrect arguments” error may indicate something else. What you can do in both cases is to remove the file

/mnt/Software/Geant4/geant4-v11.1.1-install/lib64/cmake/Geant4/Geant4PackageCache.cmake

as this is optional. However, depending on the changes in the newer(?) version of Fedora, you might also need to reinstall Geant4 if these are significant (e.g. dependent package ABIs have changed).

Thanks Benjamin,

I did re-install Geant4 after getting the new Fedora. I can remove this file, but it was looking for it and it might complain “Could not find…”, anything I do to deal with this bug, other than removing the file (which I will keep as the last resort)?

The file is optional - it will only be used if it is present, so safe to delete it.

Thank you. I will try that tomorrow when I go to the lab to work. I shall let you know how it goes.

Good Morning Benjamin,

Thanks for affirming it. I followed your advice and deleted the file from the package. The cmake worked and I was able to use make to generate executable file. When I tried to execute, it gave me this error (see below, and please advise), thanks.

neera@VM-NII-FS37-01 B1-build]$ cmake -DCMAKE_PREFIX_PATH=/mnt/Software/Geant4/geant4-v11.1.1-install/lib64/Geant4-G4VERSION $HOME/Documents/basic/B1
– Configuring done (0.2s)
– Generating done (0.0s)
– Build files have been written to: /home/neera/Documents/basic/B1-build
[neera@VM-NII-FS37-01 B1-build]$ make -j4
[ 12%] Building CXX object CMakeFiles/exampleB1.dir/exampleB1.cc.o
[ 25%] Building CXX object CMakeFiles/exampleB1.dir/src/ActionInitialization.cc.o
[ 37%] Building CXX object CMakeFiles/exampleB1.dir/src/DetectorConstruction.cc.o
[ 50%] Building CXX object CMakeFiles/exampleB1.dir/src/EventAction.cc.o
[ 62%] Building CXX object CMakeFiles/exampleB1.dir/src/PrimaryGeneratorAction.cc.o
[ 75%] Building CXX object CMakeFiles/exampleB1.dir/src/RunAction.cc.o
[ 87%] Building CXX object CMakeFiles/exampleB1.dir/src/SteppingAction.cc.o
[100%] Linking CXX executable exampleB1
[100%] Built target exampleB1

[neera@VM-NII-FS37-01 B1-build]$ ls
CMakeCache.txt cmake_install.cmake exampleB1.in init_vis.mac run1.mac tsg_offscreen.mac
CMakeFiles exampleB1 exampleB1.out Makefile run2.mac vis.mac
[neera@VM-NII-FS37-01 B1-build]$ ./exampleB1
Available UI session types: [ tcsh, csh ]

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : PART70000
issued by : G4NuclideTable
G4ENSDFSTATEDATA environment variable must be set
*** Fatal Exception *** core dump ***
**** Track information is not available at this moment
**** Step information is not available at this moment

-------- EEEE -------- G4Exception-END --------- EEEE -------

*** G4Exception: Aborting execution ***
Abort (core dumped)

This is discussed in the Geant4 Installation Guide. Before you run the executable, you need to have your Geant4 environment properly defined, by sourcing the geant4.sh (or .csh) script.

1 Like

Thanks for your note. I went back and ran the command line for data installation with

cmake -DGEANT4_INSTALL_DATA=ON

and all the files in the package were probably rewritten. At least I found the data folder with all the data packages listed in the guide. Then I read about the post-installation setup in the Installation Guide. It says:

On interactive Bourne shells (e.g. bash), do (assuming you are in CMAKE_INSTALL_PREFIX/bin):

$ source geant4.sh

I couldn’t find where is the above folder, so I gave up and attempted to generate and execute the exampleB1 file with what I had done so far. The execution generated a long list, most of which was reading the data, I guess, and finally gave me this error:
#
# Visualization setting
/control/execute vis.mac
# Macro file for the visualization setting in the initialization phase
# of the B1 example when running in interactive mode
#
# Use these open statements to open selected visualization
#
# Use this open statement to create an OpenGL view:
/vis/open OGL 600x600-0+0
/vis/sceneHandler/create OGL
parameter value (OGL) is not listed in the candidate List.

  • Candidates are: ASCIITree ATree DAWNFILE G4HepRepFile HepRepFile RayTracer VRML2FILE gMocrenFile TOOLSSG_OFFSCREEN TSG_OFFSCREEN TOOLSSG_OFFSCREEN TSG_OFFSCREEN TSG_FILE*

-------- WWWW ------- G4Exception-START -------- WWWW -------
**** G4Exception : UIMAN0123*

  •  issued by : G4UImanager::ApplyCommand*
    

Invoked command has failed - see above. Available graphics systems are:

  • Registered graphics systems are:*
  • ASCIITree (ATree)*
  • DAWNFILE (DAWNFILE)*
  • G4HepRepFile (HepRepFile)*
  • RayTracer (RayTracer)*
  • VRML2FILE (VRML2FILE)*
  • gMocrenFile (gMocrenFile)*
  • TOOLSSG_OFFSCREEN (TSG_OFFSCREEN)*
  • TOOLSSG_OFFSCREEN (TSG_OFFSCREEN, TSG_FILE)*

Error code : 500
**** This is just a warning message. ****
-------- WWWW -------- G4Exception-END --------- WWWW -------

****** Illegal parameter (0) </vis/open OGL 600x600-0+0> ******

****** Batch is interrupted!! ******

-------- WWWW ------- G4Exception-START -------- WWWW -------
**** G4Exception : UIMAN0123*

  •  issued by : G4UImanager::ApplyCommand*
    

Command aborted (500)
Error code : 500
**** This is just a warning message. ****
-------- WWWW -------- G4Exception-END --------- WWWW -------

****** Illegal parameter (0) </control/execute vis.mac> ******

****** Batch is interrupted!! ******

-------- WWWW ------- G4Exception-START -------- WWWW -------
**** G4Exception : UIMAN0123*

  •  issued by : G4UImanager::ApplyCommand*
    

Command aborted (500)
Error code : 500
**** This is just a warning message. ****
-------- WWWW -------- G4Exception-END --------- WWWW -------
idle>

Did you build your Geant4 with OpenGL enabled? The Installation Guide has discussions about what visualization models are built and how to select them.

Thanks, I did not find any discussion on OpenGL option in the Installation Guide. I am using UNIX and the guide gives a very brief list of commands, in which I did not find OpenGL. I just googled this problem and found an old issue faced by someone who used these options:

The settings I had on for cmake were:
“-DGeant4_INSTALL_DATA=ON”
“-DGeant4_USE_OPENGL_X11=ON”
“-DGeant4_USE_QT=ON”
I also was trying “-DGeant4_BUILD_MULTITHREADED=ON” but stopped since I wasn’t confident it was needed.

I only used the Option of -DGEANT4_INSTALL_DATA=ON. Do I need to redo it with other options too? which ones, please? This user above was not sure (2015 issue). Thanks.

The Installation Guide covers options in the main guide, with all of them documented in the Build Options section.

Yes, you need to redo the configure/build/install of Geant4 itself with -DGEANT4_USE_OPENGL_X11=ON, but you can do that from an existing build directory if you still have it.

Thank you. I messed up and will now need to delete everything and reinstall Geant4 from source again. I will do so and add the above options (data=ON and OpenGL commands) before the ‘make’ command, so hopefully the rest should be smooth. Since I am currently the only active user, this won’t interfere with what my colleagues are doing.

I did rerun the cmake for resolving the mess I had created by mistake (I had deleted the CMakeLists.txt file by mistake) and ran the data=ON option after the initial build, from the build directory. Then, while still in the build directory, I ran the command:

cmake -DGEANT4_USE_OPENGL_x11=ON .

(with the dot at the end, similar to how I ran the previous command, and it gave me this error:

neera@VM-NII-FS37-01 geant4-v11.1.1-build]$ cmake -DGEANT4_USE_OPENGL_X11=ON .
– Checking C++ feature CXXSTDLIB_FILESYSTEM_NATIVE - Success
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find OpenGL (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY
OPENGL_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake/Modules/FindOpenGL.cmake:545 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
cmake/Modules/G4InterfaceOptions.cmake:199 (find_package)
cmake/Modules/G4CMakeMain.cmake:64 (include)
CMakeLists.txt:49 (include)

– Configuring incomplete, errors occurred!

Please advise, thanks.

O.k., this means the system doesn’t have the packages for the OpenGL library and headers installed. I’m not familiar with Fedora, so I don’t know the exact package names that’ll supply the needed files, but the later are at least:

  • gl.h, glx.h
  • libGL.so, libGLX.so

There will be others, like X11 etc, though I expect installing the above would provide most of the dependencies. If you don’t have the needed permissions to install packages, you’ll need to ask the sysadmins to do this.