Kahibaro
Login Register

Compiling Source

You can also install it from source. The following example is based on Ubuntu 22.04 and GEANT4 11.2.2. However, for most of the other version, the commands should not differ significantly.

Make a folder with following command in terminal or visual studio:

mkdir GEANT4

Enter to the folder and then download the GEANT4 installation file from ٰGEANT4 site (https://geant4.web.cern.ch/) and download newest version tar.gz file.
You can also download the version in terminal with following command:

wget https://gitlab.cern.ch/geant4/geant4/-/archive/v11.3.2/geant4-v11.3.2.tar.gz

After finishing the process, you should install it:

wget https://gitlab.cern.ch/geant4/geant4/-/archive/v11.3.2/geant4-v11.3.2.tar.gz
tar xzfv geant4-v11.2.2.tar.gz

Create a new folder:

mkdir geant4-v11.2.2-build

Go to the folder:

cd geant4-v11.2.2-build

Now we can do cmake configuration part. if you have not cmake in your system install it first:

sudo apt install cmake cmake-curses-gui
ccmake ../geant4-v11.2.2

The gui won't show anything but if you type c for configure then the configuration will be done. If you type e you can see different possibilities that we can adjust in the installation.

After that write following commands and install packages:

sudo apt install -y g++ gcc binutils libx11-dev libxpm-dev \
libxft-dev libxext-dev libglew-dev libjpeg-dev libpng-dev libtiff-dev \
libgif-dev libxml2-dev libssl-dev libfftw3-dev libqtcore5a libxmu-dev \

Then

ccmake ../geant4-v11.2.2

Activate options that you want to use as the pictutre.

Activation part.

After activation change CMAKE_INSTALL_PREFIX part and address there the directory path of your installation then press c for configuration.

Now you can do make process:

make -j4

It takes some times to complete the process. the next step is:

make install

After this process you will find four folders (bin, include, lib and share) in the installation folder (geant4-v11.2.2-install), go into share folder and then go to another folder that is called Geant4 and into this we should enter another folder geant4make. In this folder you should find a file that is called geant4make.sh, you can source this file with terminal by going to bashrc file.

vim /home/(your system name)/.bashrc

Create alias with geant4make and address the place that geant4make.sh is there.

alias geant4make = "source/home/(your system name)/Software/Geant4/geant4-v11.2.2-install/share/Geant4/geant4make/geant4make.sh"

For testing your installation in the following address in terminal and write geant4make, if you did not find any error it was installed perfectly well.

Views: 27

Comments

Please login to add a comment.

Don't have an account? Register now!