Categories
Uncategorized

GEANT4 on Ubuntu 22.04

Geant4 on Ubuntu 22.04 build instructions for the discerning radiation transport modeller.

The reference instructions for Geant4 can be found here. On Ubuntu 22.04, I found the following packages are required for the build options used below:

xlibmesa-glu-dev
libglew-dev
libx11-dev
libxmu-dev
qtbase5-dev

Your millage may vary. To build, first, make a directory called geant4 somewhere sensible, and move into it.

mkdir geant4
cd geant4

Next, clone the ROOT git repository using:

git clone https://github.com/Geant4/geant4.git geant4-git

Now, inside the genat4-git directory, checkout a particular version:

git checkout v11.0.3

And then make build and install directories:

mkdir geant4-v11.0.3-build
mkdir genat4-v11.0.3-install

And then build…

cd geant4-v11.0.3-build
cmake -DCMAKE_INSTALL_PREFIX=../geant4-v11.0.3-install -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_X11_OPENGL=ON -DGEANT4_USE_QT=ON ../geant4-git
make -j 4
make install

Next add the following to the .bashrc file:

source /path/to/geant4/geant4-v11.0.3-install/bin/geant4.sh

Did I magically have some prerequisites installed? Probably! Does this post merit the sad face at the top? Probably not! I will endeavour to update as required.

(2023-04-28) Updated to include a packages list.

Leave a Reply