Before proceeding with the installation, some key environment variables must be defined in your user environment in order to specify where all software components are to be placed and to set some compilation options. A complete reference to all environment variables in Geant4 is available in section Appendix - Makefiles and Environment Variables of the Geant4 User's Guide for Application Developers .
set to one of the flavors listed in section 1.1 to specify the kind of architecture and compiler used
path where the Geant4 toolkit tree is installed (ex.
path to the CLHEP installation
path of the user's working directory (default in
path where the kernel libraries should be installed (default in
path where temporary files (object files, dependency files) are
placed (default in
path where final executable files are placed (default in
path where source header files may be mirrored at installation
make includes (default in
flag specifying that libraries be built with debug symbols (requires a lot of disk space). The default is optimised-mode
flag specifying that kernel libraries be built as shared libraries (libraries will then be used by default). If not set, static archive libraries are built by default
flag specifying that kernel libraries be built as static
archive libraries. Note that you may specify this flag in addition
G4LIB_BUILD_SHARED to build shared and static
flag specifying that the library for the g3tog4 module be built. By default the library will not be built.
flag specifying that an additional library for file compression should be built (not required on Linux/Unix systems, required on Windows if choosing OpenGL or OpenInventor visualization). By default the library will not be built.
defining this flag prevents the compilation of verbosity code (for better performance). The default is with verbosity on.
The Geant4 installation requires native STL (the Standard Template Library) as the base foundation class library. This also implies strict ISO-ANSI language compliance. In addition to the above, you might want to set the proper environment for visualization, such as:
the kind of graphics driver(s) installed in the system
the path to the installation of each graphics driver
in case you want to build the Geant4 kernel libraries with the graphics drivers built-in. See Visualization - The Visualization Drivers of the Geant4 User's Guide for Application Developers .
At this point, you may choose one of two ways to compile and
install the kernel libraries, depending on your needs and system
This will make one library for each "leaf" category (maximum library granularity) and automatically produce a map of library use and dependencies.
This will make global libraries, one for each major category.
The main advantage of the first approach is the speed of building the libraries and of the application, which in some cases can be improved by a factor of two or three compared to the "global library" approach.
Using the "granular library" approach a fairly large number
(roughly 90) of "leaf" libraries is produced. However, the
dependencies and linking list are evaluated and generated
automatically on the fly. The top-level
$G4INSTALL/source parses the dependency files of
Geant4 and produces a file
libname.map is produced by the
liblist, whose source code is in
When building a binary application the script
parse the user's dependency files and use
to determine through
liblist the required libraries to
add to the linking list. Only the required libraries will be loaded
in the link command.
make 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.
It is possible to install both "granular" and "compound" libraries, by typing "make" and "make global" in sequence. In this case, to choose usage of granular libraries at link time one should set the flag G4LIB_USE_GRANULAR in the environment; otherwise compound libraries will be adopted by default.