|
|
Installation Guide |
2. Installation Procedures
In this section, a short tutorial on how to install the toolkit's
kernel libraries will be given. The installation of the Geant4 kernel
libraries and the proper configuration of the environment can be
achieved either manually (by setting the proper environment variables)
or through the Configure shell script, which will allow
the installation of just the necessary source code and libraries in a
specified installation area.
Before proceeding with the installation, you need to define some key environment variables in your user environment in order to specify where all software components are placed and to set some compilation options. A complete reference to all environment variables in Geant4 is available in section 10.5 of the "User's Guide - For Application Developers".
G4SYSTEM: G4INSTALL:
$HOME/geant4)
CLHEP_BASE_DIR:
G4WORKDIR: $G4INSTALL)
G4LIB: $G4INSTALL/lib)
G4TMP:$G4WORKDIR/tmp)G4BIN:$G4WORKDIR/bin).
G4INCLUDE:
gmake includes (default in $G4INSTALL/include)
G4DEBUG:
G4LIB_BUILD_SHARED:
G4LIB_BUILD_STATIC:
G4LIB_BUILD_SHARED to build shared and static libraries
simultaneously.
G4USE_G3TOG4:
G4_NO_VERBOSE:
At this point, you may choose one of two ways to compile and install the
kernel libraries, depending on your needs and system resources.
From $G4INSTALL/source:
gmakegmake globalGNUmakefile in $G4INSTALL/source parses the
dependency files of Geant4 and produces a file libname.map in
$G4LIB.
libname.map is produced by the tool liblist, whose
source code is in $G4INSTALL/config.binmake.gmk in
$G4INSTALL/config will parse the user's dependency files and use
libname.map to determine through liblist the required
libraries to add to the linking list. Only the required libraries will be
loaded in the link command.gmake libmap issued from $G4INSTALL/source,
allows manual rebuilding of the dependency map. The command is issued by
default in the normal build process for granular libraries.Configure Shell ScriptConfigure shell script is placed in the top directory tree
of the distribution (geant4/Configure) and allows the user or system
administrator to install the Geant4 toolkit in a semi-automatic way.
It requires some knowledge of the system from the installer, such as:
$G4INSTALL)
geant4:
> ./Configure -buildand follow the on-screen instructions. The script will ask to specify the path in the system where the Geant4 libraries should be installed later on. The script provides default settings for most of the environment variables to be set. By pressing -RETURN-, the default values will be selected; otherwise the proper selection (or path, in case a path is requested) must be typed in.
In case the installation procedure fails for some reason or you realise the selected options were not correct at the time the installation started, you can repeat the whole process by manually removing the current installation with:
> cd geant4/source > gmake cleanwhere
$G4SYSTEM is manually set in your environment.
In case new modules must be added to an existing build (for example
a module for visualization), this can be done manually by re-running
Configure and providing the new settings.
Once the process of building the libraries has been completed successfully, the Geant4 toolkit can be installed in the specified (already existing) installation area by typing:
> ./Configure -installLibraries and necessary source code will be installed in lib/geant4, include/geant4 (if selected to install all headers in a single directory), src/geant4, respectively.
$G4INSTALL will be set to [INSTALLATION_AREA]/src/geant4.
Configure script
provides a way to check the existing installation and provide the correct
configuration for the user's environment. Configuration scripts
env[.sh.csh] can be generated, and should be sourced by the final users
in order to configure their environment for the installation.> $G4INSTALL/ConfigureThis will generate the shell script
env.csh (env.sh
for bash shell) to be sourced or integrated into the shell login script
(.tcshrc or .bashrc).
The shell script will be generated in the user's current directory ($PWD).
The user can customize 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.G4INCLUDE specifying the directory
path. Therefore, it's rather straightforward to integrate Geant4 into a
generic external framework, by simply knowing the path where header files are
located in the system (G4INCLUDE) and where installed libraries
are placed (G4LIB).
In section 10.5
of the Appendix, you can find a list of all the environment variables, together
with a section explaining how to integrate external libraries which may or may
not use Geant4 kernel libraries, in the GNUmake mechanism of Geant4.