The following instructions describe how to build Geant4 from source using this CD under Linux. The instructions were written using RedHat 9 with gcc 3.2.2.
First choose a location to install Geant4, e.g.
mkdir /scratch/tonyj/Geant4
cd /scratch/tonyj/Geant4/
Next install CLHEP, which can be found on the CD as:
AdditionalSoftware/CLHEP/clhep-1.8.0.2-gcc-3.2.tgz
For example, assuming you have the cdrom mounted as /mnt/cdrom you can use the commands:
mkdir CLHEP
cd CLHEP
tar -xvzf /mnt/cdrom/AdditionalSoftware/CLHEP/clhep-1.8.0.2-gcc-3.2.tgz
cd ..
The next step is to download the Geant4 which can be found on the CD in directory as
Geant4.5.2/install/geant4.5.2.p02.tar.gz
This can be unpacked in the normal way using tar:
tar -xvzf /mnt/cdrom/Geant4.5.2/install/geant4.5.2.p02.tar.gz
Geant4 requires several environment variables to be set before you can compile or run it. I use the following csh script to set things up:
setenv G4HERE `pwd`
setenv G4INSTALL $G4HERE/geant4.5.2.p02
# Check we are where we think we are
if (! -e $G4INSTALL/source/GNUmakefile) then
echo "G4INSTALL not set correctly. Please edit setup-geant4 script to fix pro
blem"
goto end
endif
setenv G4SYSTEM Linux-gcc3
setenv CLHEP_BASE_DIR $G4HERE/CLHEP
if (! -e $CLHEP_BASE_DIR/include/CLHEP/config/CLHEP.h) then
echo "CLHEP_BASE_DIR not set correctly. Please edit setup-geant4 script to fi
x problem"
goto end
endif
setenv PATH ${PATH}:${G4INSTALL}/bin/${G4SYSTEM}
setenv LD_LIBRARY_PATH ${CLHEP_BASE_DIR}/lib:$LD_LIBRARY_PATH
echo "G4INSTALL=$G4INSTALL"
echo "G4SYSTEM=$G4SYSTEM"
echo "CLHEP_BASE_DIR=$CLHEP_BASE_DIR"
end:
or the equivalent sh script:
export G4HERE=`pwd`
export G4INSTALL=$G4HERE/geant4.5.2.p02
# Check we are where we think we are
if ! test -e $G4INSTALL/source/GNUmakefile
then
echo "G4INSTALL not set correctly. Please edit setup-geant4 script to fix pro
blem"
return
fi
export G4SYSTEM=Linux-gcc3
export CLHEP_BASE_DIR=$G4HERE/CLHEP
if ! test -e $CLHEP_BASE_DIR/include/CLHEP/config/CLHEP.h
then
echo "CLHEP_BASE_DIR not set correctly. Please edit setup-geant4 script to fi
x problem"
return
fi
export PATH=${PATH}:${G4INSTALL}/bin/${G4SYSTEM}
export LD_LIBRARY_PATH=${CLHEP_BASE_DIR}/lib:$LD_LIBRARY_PATH
echo "G4INSTALL=$G4INSTALL"
echo "G4SYSTEM=$G4SYSTEM"
echo "CLHEP_BASE_DIR=$CLHEP_BASE_DIR"
With these scripts (stored as setup-geant4) building Geant4 is straightforward:
source setup-geant4.csh cd geant4.5.2.p02/source/ gmake
Come back in an hour or so and Geant4 should be compiled and nearly ready to go. You can now continue with the installation exercise.