I have a problem in running example B1 after installing multiple Geant4 releases on my computer

Geant4 Version: geant4-v11.1.3 and geant4-v11.2.0
Operating System: Ubuntu
Compiler/Version:
CMake Version: 3.29.6


Hello! I have installed Geant4-v11.2.0 in my computer and used it previously. However, I need to also install Geant4-v11.1.3 for different research and I am having a problem in running example B1 after installing the older version of Geant4.

I have read that it is possible to have multiple Geant4 version in 1 computer as long as we specifically set which version we want to use. I am confused on how to use it.

First I have tried to source geant4make.sh from the geant4make folder

(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/share/Geant4/geant4make$ source geant4make.sh
.
.
.
(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B1/build$ cmake ..
.
.
.
-- Found Geant4: /home/cecilia/software/geant4/geant4-v11.2.0-install/lib/cmake/Geant4/Geant4Config.cmake (found version "11.2.0")
-- Configuring done (0.9s)
-- Generating done (0.0s)
-- Build files have been written to: /home/cecilia/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B1/build
(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B1/build$ make
.
.
.
[100%] Built target exampleB1
(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B1/build$ ./exampleB1 
./exampleB1: symbol lookup error: ./exampleB1: undefined symbol: _ZN17G4UserEventAction13MergeSubEventEP7G4EventPKS0

And then I tried to source geant4.sh from the bin folder and rebuild the B1 example

(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/bin$ source geant4.sh 
(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/bin$ cd ~/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B1/build
(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B1/build$ cmake ..
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/cecilia/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B1/build
(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B1/build$ make
[100%] Built target exampleB1
(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B1/build$ ./exampleB1
./exampleB1: symbol lookup error: ./exampleB1: undefined symbol: _ZN17G4UserEventAction13MergeSubEventEP7G4EventPKS0_

The same error persist. I tried with a different example which is B2a

(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B2/B2a/build$ cmake ..
.
.
.
-- Found Geant4: /home/cecilia/software/geant4/geant4-v11.2.0-install/lib/cmake/Geant4/Geant4Config.cmake (found version "11.2.0")
-- Configuring done (0.9s)
-- Generating done (0.0s)
-- Build files have been written to: /home/cecilia/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B2/B2a/build
(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B2/B2a/build$ make
.
.
.
(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B2/B2a/build$ make
[100%] Built target exampleB2a
(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B2/B2a/build$ ./exampleB2a 
./exampleB2a: symbol lookup error: ./exampleB2a: undefined symbol: _ZN17G4UserEventAction13MergeSubEventEP7G4EventPKS0_

The same error persist. I want to try to directly specify which Geant4 to use but I kept getting error.

(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B2/B2a/build$ cmake ~/software/geant4/geant4-v11.1.3
CMake Error: The source "/home/cecilia/software/geant4/geant4-v11.1.3/CMakeLists.txt" does not match the source "/home/cecilia/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B2/B2a/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.
(base) cecilia@cecilia-X570-AORUS-ELITE:~/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B2/B2a/build$ cmake ~/software/geant4/geant4-v11.1.3/
CMake Error: The source "/home/cecilia/software/geant4/geant4-v11.1.3/CMakeLists.txt" does not match the source "/home/cecilia/software/geant4/geant4-v11.1.3-install/share/Geant4/examples/basic/B2/B2a/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.

Can anyone please help me with this issue?

Thank you for your attention

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