Geant4 v11.1.0 installation on a Debian Bullseye (should work on Ubuntu also)

The solution is quite long but copy paste from here should be sufficient (quite easy).

Prerequesite: a fresh conda installation

Description for anaconda installation:

$ bash Anaconda-latest-Linux-x86_64.sh

It’s also possible to start from an existing working anaconda installation but please make sure that the base environment is updated. Try something like :

$ conda update -n base conda

Note: I tried as specified in the Geant4 Installation guide :

$ conda create -c conda-forge --name my_geant4 geant4
$ conda activate my_geant4

This doesn’t bring a working environment : the first try with basic/B1 compilation produces errors.

The installation presented here was a success on many Debian 11 systems.

So, now that you have a working anaconda let’s go:

$ conda create -n g4_11.1
$ conda activate g4_11.1
$ conda config --add channels conda-forge
$ conda install make cmake compilers sed \
mesa-libgl-devel-cos7-x86_64 mesa-dri-drivers-cos7-x86_64 \
libselinux-cos7-x86_64 libxdamage-cos7-x86_64 \
libxxf86vm-cos7-x86_64 libxext-cos7-x86_64 \
python boost=1.80.0 \
clhep=2.4.6.2 expat freetype \
libglu qt=5.15 xerces-c \
zlib tbb \
xorg-libx11 xorg-libxfixes xorg-libxmu xorg-libxfixes

It will take time and you have to answer “y” to proceed… Then ensure that you have a devel/Geant4 directory in your Home directory and…

$ cd $HOME/devel/Geant4

bring the tar.gz geant4 archive here (in ‘$HOME/devel/Geant4’) and proceed with:

$ tar xvfz geant4-v11.1.0.tar.gz
$ mkdir build_g4_11.1
$ cd build_g4_11.1
$ export GEANT4_INSTALL=$HOME/anaconda3/envs/g4_11.1
$ cmake $HOME/devel/Geant4/geant4-v11.1.0 \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$GEANT4_INSTALL \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_CXX_STANDARD=17 \
-DGEANT4_BUILD_MULTITHREADED=ON \
-DGEANT4_BUILD_TLS_MODEL=global-dynamic \
-DGEANT4_INSTALL_DATA=ON \
-DGEANT4_INSTALL_DATASETS_TENDL=ON \
-DGEANT4_INSTALL_DATA_TIMEOUT=3000 \
-DGEANT4_INSTALL_EXAMPLES=ON \
-DGEANT4_USE_FREETYPE=ON \
-DGEANT4_USE_GDML=ON \
-DGEANT4_USE_QT=ON \
-DGEANT4_USE_QT3D=ON \
-DGEANT4_USE_SYSTEM_CLHEP=ON \
-DGEANT4_USE_SYSTEM_EXPAT=ON \
-DGEANT4_USE_SYSTEM_ZLIB=ON \
-DGEANT4_USE_PYTHON=ON \
-DGEANT4_USE_OPENGL_X11=ON \
-DGEANT4_USE_RAYTRACER_X11=ON

$ make -j 12

These will take very long time and can be repeated, specially if there was errors (normally they should not have errors but memory can stop some compilation and the repeat will just finish the work.

Then:

$ make install

It’s done!!!

Just in case that you want to compile a provided example (like: ‘basic/B1’):

$ conda activate g4_11.1
$ source geant4.sh
$ cd $HOME/devel/Geant4/geant4-v11.1.0/examples/basic
$ make B1_build
$ cd B1_build
$ cmake …/B1
$ make -j 12
$ ./exampleB1

That’s easy!
Hope this helps you, I had to search and take advantage of this post to build this solution for the new geant4-v11.1.0.
Cheers
Pat

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