The installation in Ubuntu 22.04 can be found at the end of this post. The trick for the installation is enabling visualization. The one I pick is the Qt OpenGL, and it requires to have Qt installation.

To install Qt, I download the Qt installer from the Qt website. In the installer, I pick the manual components to install. The components are

  • Qt > Qt 6.6.2 > macOS
  • Qt > Qt 6.6.2 > Qt Quick 3D
  • Qt > Qt 6.6.2 > Qt Shader Tools
  • Qt > Qt 6.6.2 > Qt Quick Timeline
  • Qt > Qt 6.6.2 > Additional Libraries > Qt 3D
  • Qt > Qt 6.6.2 > Additional Libraries > Quick: 3D Physics
  • Qt > Developer and Designer Tools > CMake 3.27.7
  • Qt > Developer and Designer Tools > Ninja 1.10.2

I bet some of the components are not needed. Once installed (I installed at /Users/ryantang/Qt/) , we need to export

export Qt6_DIR=/Users/ryantang/Qt/6.6.2/macos/lib/
export Qt6OpenGLWidgets_DIR=/Users/ryantang/Qt/6.6.2/macos/lib/cmake/Qt6OpenGLWidgets/

Those two line let the cmake know where to find the Qt.

Now, I downloaded the GEANT4 source code

>cd Downloads
>wget https://gitlab.cern.ch/geant4/geant4/-/archive/v11.2.0/geant4-v11.2.0.tar.gz
>tar xzf geant4-v11.2.0.tar.gz
>mkdir geant4-v11.2.0_build
>cd geant4-v11.2.0_build
>cmake -DGEANT4_INSTALL_DATA=On -DCMAKE_INSTALL_PREFIX=/opt/geant4-v11.2.0 -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_QT=ON -DGEANT4_USE_QT_QT6=ON ../geant4-v11.2.0
>make -j10
>sudo make install
>echo 'source /opt/geant4-v11.2.0/bin/geant4.sh' >> ~/.bashrc

For test, we can use the example/basic/B1, or I use the Clarion2 simulation (https://fsunuc.physics.fsu.edu/wiki/index.php/Clarion2). Here is the screen I get.