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".
gmake includes(default in
G4LIB_BUILD_SHAREDto build shared and static libraries simultaneously.
At this point, you may choose one of two ways to compile and install the
kernel libraries, depending on your needs and system resources.
$G4INSTALL/sourceparses the dependency files of Geant4 and produces a file
libname.mapis produced by the tool
liblist, whose source code is in
$G4INSTALL/configwill parse the user's dependency files and use
libname.mapto determine through
liblistthe required libraries to add to the linking list. Only the required libraries will be loaded in the link command.
gmake libmapissued from
$G4INSTALL/source, allows manual rebuilding of the dependency map. The command is issued by default in the normal build process for granular libraries.
Configureshell 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:
> ./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
$G4SYSTEMis 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.
$G4INSTALLwill be set to
Configurescript 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.shfor bash shell) to be sourced or integrated into the shell login script (
.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.
G4INCLUDEspecifying 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 (
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.