Skip to content

Compiling and Installing Geant4.9.6

Emma Davenport edited this page Jan 20, 2017 · 36 revisions

Under Construction

Download Geant4

Configuration and Compilation

Configuration using CMake

While in the Geant4.9.6 working directory

mkdir build

cd build

cmake -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON ../

If you come across errors during configuration, be sure to have dependencies installed. A list of dependencies can be found at the bottom of this page. Be mindful of differences in package names across various distributions

Compilation

make -j<number of cpu cores>

make install

Environment Variables

Absolutely Necessary

In your .bashrc under your home directory, append the followings to the end of the file. Be sure to log out and log in after adding this lines! (source .bashrc)

export G4LEDATA=/usr/local/share/Geant4-9.6.4/data/G4EMLOW6.32

export G4LEVELGAMMADATA=/usr/local/share/Geant4-9.6.4/data/PhotonEvaporation2.3

export G4SAIDXSDATA=/usr/local/share/Geant4-9.6.4/data/G4SAIDDATA1.1

export G4RADIOACTIVEDATA=/usr/local/share/Geant4-9.6.4/data/RadioactiveDecay3.6

export G4NEUTRONHPDATA=/usr/local/share/Geant4-9.6.4/data/G4NDL4.2

Helpful

Not a necessary variable to have, but it certainly makes building DarkGeant4 easier to manage.

export GEANTDIR=/path/to/geant4.9.6.p04

note, while these variables ought to be set, their paths might vary depending on your system. Be aware of that!

Red Hat Enterprise Linux 6

So thankfully everything you need to build Geant4.9.6 and DarkGeant4 are mostly in the standard repositories. However you want to enable the EPEL repository to get cmake3.x

Make sure you install cmake3 instead of just plain cmake, otherwise yum will download version 2.8 which is missing important lua configuration files.

Setting an alias might also by appropriate for cmake3

alias cmake="cmake3"

Red Hat Enterprise Linux 7

Enable EPEL to get cmake3.x

Manually install dependencies

Ubuntu 16.04

sudo apt install libx11-dev libxmu-dev mesa-common-dev mesa-util-extra libgl1-mesa-dev libglapi-mesa libglu1-mesa-dev freeglut3-dev

Red Hat Enterprise Linux 7

sudo yum install expat-devel libX11-devel libXmu-devel mesa-libGL-devel mesa-libGLU-devel