393 lines
15 KiB
Plaintext
393 lines
15 KiB
Plaintext
% Step by step Geant4 installation under linux (SL4 at PSI) - by Toni Shiroka - Jan 2008
|
|
% See also: http://geant4.slac.stanford.edu/installation/
|
|
% Source code can be downloaded via wget from: http://geant4.cern.ch/support/source/
|
|
% NOTE: Lines starting with or containing % are comments, those with # are commands.
|
|
|
|
The strategy of installing Geant4 consists of the following 5 step procedure:
|
|
|
|
1. Check program compatibility and previous Geant installations.
|
|
2. Download and unpack the required principal and auxiliary programs.
|
|
3. Install auxiliary (e.g. viewers, analysis tools, etc.) first.
|
|
4. Install CLHEP (only a compatible version).
|
|
5. Install Geant4 and configure environment variables.
|
|
|
|
|
|
Detailed list of operations to be performed:
|
|
|
|
==============================================================================================
|
|
|
|
1. Check program versions and previous Geant installations before proceeding:
|
|
|
|
# uname -a
|
|
Linux pc6297 2.6.9-42.0.2.ELsmp #1 SMP
|
|
Tue Aug 22 17:26:55 CDT 2006 i686 i686 i386 GNU/Linux
|
|
|
|
# g++ --version
|
|
g++ (GCC) 3.4.5 20051201 (Red Hat 3.4.5-2)
|
|
|
|
# ld --version
|
|
GNU ld version 2.15.92.0.2 20040927
|
|
|
|
# automake --version
|
|
automake (GNU automake) 1.9.2
|
|
|
|
# autoconf -V
|
|
autoconf (GNU Autoconf) 2.59
|
|
|
|
# java -version
|
|
java version "1.5.0_08"
|
|
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
|
|
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)
|
|
|
|
# export | grep G4 # or alternatively issue in csh shell
|
|
# setenv | grep G4
|
|
# printenv | grep G4
|
|
Ensure you get an empy line (no previous Geant4 installation on this machine)
|
|
|
|
==============================================================================================
|
|
|
|
2.a Download the required files in e.g. /root/geant4_download/
|
|
e.g.:
|
|
wget http://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/distributions/clhep-2.0.3.2-src.tgz
|
|
wget http://geant4.web.cern.ch/geant4/support/source/geant4.9.1.tar.gz
|
|
|
|
|
|
# ls /root/geant4_download
|
|
clhep-2.0.3.2-src.tgz CLHEP (New version)
|
|
geant4.9.1.gtar.gz GEANT4 rel. 9.1
|
|
G4EMLOW.5.1.tar.gz DATA (low energy events)
|
|
G4RadioactiveDecay.3.2.tar.gz DATA (optional)
|
|
PhotonEvaporation.2.0.tar.gz DATA (optional)
|
|
|
|
Note: Also clhep-1.9.2.3.tgz was downloaded and installed, due to problems
|
|
with ver. 2.0.2.3 of CLHEP.
|
|
|
|
|
|
2.b Unpack software after creating relevant directories:
|
|
(Important: Install first CLHEP and viewers and only after that geant4)
|
|
|
|
Suggested installation directories:
|
|
CLHEP: /usr/local/lib/CLHEP
|
|
geant4: /usr/local/geant4
|
|
|
|
- Create directories first:
|
|
|
|
# mkdir /usr/local/geant4
|
|
# mkdir usr/local/lib/CLHEP
|
|
%Alternatively install directly in: /usr/local/CLHEP
|
|
|
|
Create directory for LOW ENERGY electromagnetic processes,
|
|
photon evaporation, and hadronic radio-active decay data
|
|
|
|
# mkdir /usr/local/geant4/data
|
|
|
|
Create subdirectories by unzipping downloaded data:
|
|
# cd /usr/local/geant4/data
|
|
# gtar -zxvf /root/geant4_download/data/G4EMLOW.4.3.tar.gz <- VERY IMPORTANT!
|
|
# gtar -zxvf /root/geant4_download/data/PhotonEvaporation.2.0.tar.gz
|
|
# gtar -zxvf /root/geant4_download/data/G4RadioactiveDecay.3.2.tar.gz
|
|
|
|
Check installation of DATA
|
|
# ls -l /usr/local/geant4/data/
|
|
G4EMLOW5.1 PhotonEvaporation2.0 RadioactiveDecay3.2
|
|
|
|
==============================================================================================
|
|
|
|
3. Installation of some auxiliary viewers:
|
|
|
|
3.a Preliminary installation of Freewrl: http://freewrl.sourceforge.net/
|
|
|
|
Download sources, unpack, compile and test! (alternatively install from rpm)
|
|
|
|
- gtar -zxvf freewrl-1.19.8.tar.gz
|
|
- cd freewrl-1.19.8
|
|
- perl Makefile.PL
|
|
- make
|
|
- make test (not always available)
|
|
- make install
|
|
|
|
- cd test
|
|
- freewrl 10.wrl % testing e.g. file 10.wrl
|
|
|
|
3.b Preliminary installation of VRMLView: Formerly at www.sim.no,
|
|
now at www.km.kongsberg.com. In the search window type vrmlview.
|
|
Otherwise download directly from this address:
|
|
wget ftp://ftp.coin3d.org/pub/webdownloads/vrmlview_linux.tar.gz
|
|
|
|
- download vrmlview_linux.tar.gz
|
|
- gtar -zxvf vrmlview_linux.tar.gz
|
|
- put the vrmlview executable in a path directory (e.g. mv vrmlview /usr/bin/)
|
|
|
|
3.c Preliminary installation of DAWN: http://geant4.kek.jp/GEANT4/vis/
|
|
|
|
# tar -zxvf dawn_3_88a.taz
|
|
Read the file README.txt and proceed accordingly
|
|
make clean; make guiclean; ./configure; make; make install
|
|
DAWN executable and scripts should install in /usr/local/bin
|
|
To test DAWN go to the directory "dawn_VERSION/PRIM_DATA":
|
|
# cd dawn_VERSION/PRIM_DATA
|
|
Then issue the dawn command for generating postscript files, e.g.:
|
|
# dawn primitives.prim
|
|
|
|
==============================================================================================
|
|
|
|
4. Installation of CLHEP (Very Important: Check the version is compatible with Geant4!):
|
|
|
|
# gtar -zxvf clhep-2.0.3.2-src.tgz
|
|
creates the directory 2.0.3.2/CLHEP (in /root/geant4_download/geant4.9)
|
|
|
|
# cd 2.0.3.2/CLHEP
|
|
% The following three steps could also be skipped:
|
|
# autoconf
|
|
# aclocal
|
|
# automake
|
|
|
|
# cd /root/geant4_download
|
|
create a SEPARATE directory for building and go there:
|
|
# mkdir CLHEP_build
|
|
# cd CLHEP_build
|
|
# <source_code_directory>/configure --prefix=<install_dir> (e.g. /usr/local/lib/CLHEP)
|
|
(Note that files will be installed under /usr/local if you do not specify a prefix.)
|
|
(E.g. if using many CLHEP versions, from CLHEP_build directory issue this command:)
|
|
../geant4_additions/2.0.3.2/CLHEP/configure --prefix=/usr/local/lib/CLHEP/2.0.3.2
|
|
|
|
# make
|
|
(Build temporary copies of libraries and executables.)
|
|
# make check
|
|
(Run the tests.)
|
|
# make install
|
|
(Copy libraries, headers, executables, etc. to relevant subdirectories under <install_dir>.)
|
|
|
|
Note: Do not forget to remove unnecessary files and directories after installation:
|
|
e.g. \rm -rf 2.0.3.2; \rm -rf CLHEP_build
|
|
|
|
Check shared library dependencies (after going to the /usr/local/lib/CLHEP/lib directory):
|
|
# ldd libCLHEP-2.0.3.2.so
|
|
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x004fc000)
|
|
libm.so.6 => /lib/tls/libm.so.6 (0x00d58000)
|
|
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00111000)
|
|
libc.so.6 => /lib/tls/libc.so.6 (0x00e8e000)
|
|
/lib/ld-linux.so.2 (0x009d8000)
|
|
|
|
|
|
==============================================================================================
|
|
|
|
5. Installation of Geant 4.9.1
|
|
|
|
Unpack, configure paths and variables, compile, install, set environment variables
|
|
%unpack; ./configure; make; make install
|
|
|
|
5.a Unpacking and initial configuration
|
|
|
|
# gtar -zxvf geant4.9.1.gtar.gz -C /usr/local/geant4
|
|
will create a new INSTALLATION directory:
|
|
/usr/local/geant4/geant4.9.1
|
|
|
|
Rename it to 4.9.1 and go there:
|
|
# mv /usr/local/geant4/geant4.9.1 /usr/local/geant4/4.9.1
|
|
# cd /usr/local/geant4/4.9.1
|
|
# ./Configure -build
|
|
Configure all the installation options before installing. VERY IMPORTANT!
|
|
It creates a hidden directory .config. Remove it in case of reinstalls.
|
|
|
|
WARNING: the generated configuration file can be edited if necessary!
|
|
You can introduce any change to the configuration file
|
|
/usr/local/geant4/4.9.1/.config/bin/Linux-g++/config.sh
|
|
before the final installation. To do so, use a shell escape now
|
|
(e.g. !vi /usr/local/geant4/4.9.1/.config/bin/Linux-g++/config.sh)
|
|
|
|
Install log written in:
|
|
/usr/local/geant4/4.9.1/.config/bin/Linux-g++/g4make.log
|
|
|
|
|
|
5.b Building and installing
|
|
|
|
Only for the OLD versions! For the new ones just press ENTER.
|
|
# ./Configure -build
|
|
% -build : start configuration AND build of Geant4 libraries
|
|
|
|
On this machine the G4SYSTEM=Linux-g++
|
|
On this machine the G4INSTALL=/usr/local/geant4/4.9.1
|
|
On this machine the G4TMP=/usr/local/geant4/4.9.1/tmp
|
|
On this machine the G4LIB=/usr/local/geant4/4.9.1/lib
|
|
On this machine the G4LEVELGAMMADATA=/usr/local/geant4/data/PhotonEvaporation2.0
|
|
On this machine the G4RADIOACTIVEDATA=/usr/local/geant4/data/RadioactiveDecay3.2
|
|
On this machine the G4LEDATA=/usr/local/geant4/data/G4EMLOW5.1
|
|
On this machine the G4NEUTRONHPDATA=/usr/local/geant4/data/G4NDL3.12
|
|
On this machine the G4ABLADATA=/usr/local/geant4/data/G4ABLA3.0
|
|
On this machine the CLHEP_BASE_DIR=/usr/local/lib/CLHEP/2.0.3.2
|
|
On this machine the CLHEP_INCLUDE_DIR=/usr/local/lib/CLHEP/2.0.3.2/include
|
|
On this machine the CLHEP_LIB_DIR=/usr/local/lib/CLHEP/2.0.3.2/lib
|
|
On this machine the CLHEP_LIB=CLHEP
|
|
On this machine the G4DEBUG=1
|
|
On this machine the G4UI_BUILD_XAW_SESSION=1
|
|
On this machine the G4UI_USE_XAW=1
|
|
On this machine the G4UI_BUILD_XM_SESSION=1
|
|
On this machine the G4UI_USE_XM=1
|
|
On this machine the G4VIS_BUILD_DAWN_DRIVER=1
|
|
On this machine the G4VIS_BUILD_OPENGLX_DRIVER=1
|
|
On this machine the G4VIS_BUILD_OPENGLXM_DRIVER=1
|
|
On this machine the G4VIS_BUILD_VRML_DRIVER=1
|
|
On this machine the G4VIS_USE_DAWN=1
|
|
On this machine the G4VIS_USE_OPENGLX=1
|
|
On this machine the G4VIS_USE_OPENGLXM=1
|
|
On this machine the G4VIS_USE_VRML=1
|
|
On this machine the XMFLAGS= -I/usr/X11R6/include
|
|
On this machine the XMLIBS= -lXm -lXpm
|
|
On this machine the XMFLAGS= -I/usr/X11R6/include
|
|
On this machine the XAWFLAGS= -I/usr/X11R6/include
|
|
On this machine the XAWLIBS= -lXaw
|
|
On this machine the G4LIB_BUILD_STATIC=1
|
|
On this machine the G4LIB_USE_GRANULAR=1
|
|
|
|
Starting build...
|
|
|
|
*************************************************************
|
|
Installation Geant4 version : geant4-09-01
|
|
Copyright (C) 1994-2007 Geant4 Collaboration
|
|
*************************************************************
|
|
|
|
Takes from 1 to 2 hours at least!
|
|
|
|
####################################################
|
|
# Your Geant4 installation seems to be successful!
|
|
# To be sure please have a look into the log file:
|
|
# /usr/local/geant4/4.9.1/.config/bin/Linux-g++/g4make.log
|
|
####################################################
|
|
|
|
% Check files and directories (notice especially the modification dates)
|
|
|
|
[root@pc6297 4.9.1]# ls -lAtr
|
|
total 176
|
|
-rw-r--r-- 1 15277 1196 4029 Dec 13 16:31 LICENSE
|
|
-rwxr-xr-x 1 15277 1196 130696 Dec 13 16:31 Configure
|
|
drwxr-xr-x 4 15277 1196 4096 Dec 13 16:38 config
|
|
drwxr-xr-x 22 15277 1196 4096 Dec 13 16:38 source
|
|
drwxr-xr-x 2 15277 1196 4096 Dec 13 16:38 ReleaseNotes
|
|
drwxr-xr-x 5 15277 1196 4096 Dec 13 16:38 examples
|
|
drwxr-xr-x 4 15277 1196 4096 Dec 13 16:38 environments
|
|
drwxr-xr-x 5 root root 4096 Jan 17 12:59 .config
|
|
drwxr-xr-x 3 root root 4096 Jan 17 13:00 tmp
|
|
drwxr-xr-x 3 root root 4096 Jan 17 13:00 lib
|
|
drwxr-xr-x 2 root root 4096 Jan 17 13:00 include
|
|
drwxr-xr-x 2 root root 4096 Jan 17 13:00 bin
|
|
|
|
[root@pc6297 4.9.1]# ./Configure -install
|
|
% -install : start installation of Geant4 libraries in the previously specified directories
|
|
% Use only if the final installation directory and the source code directory are different.
|
|
|
|
On this machine the G4SYSTEM=Linux-g++
|
|
........................................
|
|
On this machine the G4LIB_USE_GRANULAR=1
|
|
Starting installation...
|
|
|
|
[root@pc6297 4.9.1]# ls -lAtr
|
|
total 180
|
|
-rw-r--r-- 1 15277 1196 4029 Dec 13 16:31 LICENSE
|
|
-rwxr-xr-x 1 15277 1196 130696 Dec 13 16:31 Configure
|
|
drwxr-xr-x 4 15277 1196 4096 Dec 13 16:38 config
|
|
drwxr-xr-x 22 15277 1196 4096 Dec 13 16:38 source
|
|
drwxr-xr-x 2 15277 1196 4096 Dec 13 16:38 ReleaseNotes
|
|
drwxr-xr-x 5 15277 1196 4096 Dec 13 16:38 examples
|
|
drwxr-xr-x 4 15277 1196 4096 Dec 13 16:38 environments
|
|
drwxr-xr-x 3 root root 4096 Jan 17 13:00 tmp
|
|
drwxr-xr-x 3 root root 4096 Jan 17 13:00 lib
|
|
drwxr-xr-x 2 root root 4096 Jan 17 13:00 include
|
|
drwxr-xr-x 2 root root 4096 Jan 17 13:00 bin
|
|
drwxr-xr-x 3 root root 4096 Jan 17 16:24 src
|
|
drwxr-xr-x 4 root root 4096 Jan 17 16:24 .config
|
|
|
|
|
|
5.c Once libraries have been installed, set the user's environment
|
|
|
|
# ./Configure (if launched from directory $G4INSTALL)
|
|
|
|
[root@pc6297 4.9.1]# ls -lAtr
|
|
total 212
|
|
-rw-r--r-- 1 15277 1196 4029 Dec 13 16:31 LICENSE
|
|
-rwxr-xr-x 1 15277 1196 130696 Dec 13 16:31 Configure
|
|
drwxr-xr-x 4 15277 1196 4096 Dec 13 16:38 config
|
|
drwxr-xr-x 22 15277 1196 4096 Dec 13 16:38 source
|
|
drwxr-xr-x 2 15277 1196 4096 Dec 13 16:38 ReleaseNotes
|
|
drwxr-xr-x 5 15277 1196 4096 Dec 13 16:38 examples
|
|
drwxr-xr-x 4 15277 1196 4096 Dec 13 16:38 environments
|
|
drwxr-xr-x 3 root root 4096 Jan 17 13:00 tmp
|
|
drwxr-xr-x 3 root root 4096 Jan 17 13:00 lib
|
|
drwxr-xr-x 2 root root 4096 Jan 17 13:00 include
|
|
drwxr-xr-x 2 root root 4096 Jan 17 13:00 bin
|
|
drwxr-xr-x 3 root root 4096 Jan 17 16:24 src
|
|
-rwxr-xr-x 1 root root 15379 Jan 17 16:25 env.sh
|
|
-rwxr-xr-x 1 root root 12323 Jan 17 16:25 env.csh
|
|
drwxr-xr-x 4 root root 4096 Jan 17 16:25 .config
|
|
|
|
To determine and generate the correct shell script env.csh to be sourced
|
|
or integrated in the shell login script (.tcsh for example). The shell
|
|
script will be generated by default in the user's current directory ($PWD).
|
|
The user can customise it to specify for example his/her proper working
|
|
directory through the variable $G4WORKDIR. Once the generated script is
|
|
sourced, the user will be ready to start building a Geant4 application.
|
|
|
|
To simplify the day-to-day Geant4 usage before starting compilation issue
|
|
(or put in your existing .cshrc or .bashrc file):
|
|
|
|
source env.sh or . env.csh
|
|
If necessary, edit also $G4WORKDIR.
|
|
|
|
To correctly visualise files under GEANT4, set the viewer to e.g. VRML files.
|
|
So, OUTSIDE Geant 4 program, set the variable G4VRMLFILE_VIEWER to one of the following:
|
|
|
|
setenv G4VRMLFILE_VIEWER vrmlview
|
|
setenv G4VRMLFILE_VIEWER freewrl
|
|
|
|
Once in Geant4, do not forget to press Ctrl+C after each visualisation:
|
|
Idle>/vis/open VRML2FILE
|
|
|
|
In some cases, when using CLHEP SHARED libraries, one might need to specify the
|
|
path where libCLHEP.so is installed through the environment variable LD_LIBRARY_PATH.
|
|
For example:
|
|
|
|
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$CLHEP_BASE_DIR/lib % bash shell
|
|
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$CLHEP_BASE_DIR/lib % tcsh shell
|
|
|
|
Or insert it directly in the env.sh file (best solution):
|
|
if [ $LD_LIBRARY_PATH ] ; then
|
|
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${G4LIB}/${G4SYSTEM}
|
|
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CLHEP_BASE_DIR}/lib
|
|
export LD_LIBRARY_PATH
|
|
else
|
|
LD_LIBRARY_PATH=${G4LIB}/${G4SYSTEM}
|
|
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CLHEP_BASE_DIR}/lib
|
|
export LD_LIBRARY_PATH
|
|
fi
|
|
|
|
Note: Once finished, all of the above is automatically taken care off
|
|
if one just issues #g49 --> already included in an .alias or .bashrc file.
|
|
|
|
alias g49='source /usr/local/geant4/4.9.1/env.sh; export G4VRMLFILE_VIEWER=vrmlview; echo "On this machine the G4VRMLFILE_VIEWER=$G4VRMLFILE_VIEWER"'
|
|
|
|
|
|
|
|
Appendix - Final notes:
|
|
|
|
- For the complete list of variables that can be set in Geant4 see
|
|
chap. 10.5 of Geant4 User's Guide for Application Developers:
|
|
|
|
wwwasd.web.cern.ch/wwwasd/geant4/G4UsersDocuments/UsersGuides/
|
|
ForApplicationDeveloper/html/Appendix/makeFile.html
|
|
|
|
To check all Geant4 variables use e.g.:
|
|
# printenv | grep G4
|
|
|
|
To remove a wrong installation:
|
|
# cd $G4INSTALL/source
|
|
# gmake clean
|
|
|
|
To set a variable manually or to remove it just type
|
|
(in bash and tcsh shells respectively):
|
|
|
|
export VARIABLE=value
|
|
export -n VARIABLE
|
|
|
|
setenv VARIABLE value
|
|
unsetenv VARIABLE
|