Getting Started

OS/Software Prerequisites

The following source/software must be present to build Geant4:

  • Geant4 Toolkit Source Code.

  • C++ Compiler and Standard Library supporting the C++11 Standard:

    • Linux: GNU Compiler Collection 4.8.5 or higher.
      • It is strongly recommended to use the GCC compiler supplied by the package management system of your distribution unless this does not meet the minimum version requirement.
    • macOS: Apple Clang (Xcode) 8 or higher.
      • The command line tools must also be installed by running xcode-select --install from the terminal.
    • Windows: Visual Studio 2015, Community version or higher.

    The compiler and standard library need to support at least the following features of the C++11 Standard:

    • Template aliases, as defined in N2258.
    • Automatic type deduction, as defined in N1984.
    • Delegating constructors, as defined in N1986.
    • Enum forward declarations, as defined in N2764.
    • Explicit conversion operators, as defined in N2437.
    • Override control final keyword, as defined in N2928, N3206 and N3272.
    • Lambda functions, as defined in N2927.
    • Null pointer, as defined in N2431.
    • Override control override keyword, as defined in N2928, N3206 and N3272.
    • Range-based for, as defined in N2930.
    • Strongly typed enums, as defined in N2347.
    • Uniform intialization, as defined in N2640.
  • CMake 3.3 or higher.

    On Linux, we recommend that you use CMake as provided through the package management system of your distribution, unless it does not meet the minimum version requirement. In that case, we recommend you install it using the Linux binary installer for the latest version of CMake, available with instructions from the Kitware download site. This installer is highly portable and should work on the vast majority of distributions.

    On macOS and Windows, CMake is not installed by default, so we recommend that you install it using the most recent Darwin64 dmg (macOS) or Win32 exe (Windows) installers supplied by the Kitware download site. On macOS, you may also use the Homebrew or Macports package managers to install the required version.

    For more information on CMake, the CMake Help and Documentation should be consulted.

Supported and Tested Platforms

Geant4 is officially supported on the following operating system and compiler combinations:

The following platforms and compilers are also tested

  • Scientific Linux CERN 6 with Intel C/C++ Compiler >=18.X. Note that the Intel Compiler must be set up to use C++ headers and standard library supplied by GNU GCC >= 4.9 only to provide the required compatibility with the C++11 Standard.
  • Scientific Linux CERN 6 with clang 3.9/5.0.
  • Ubuntu Linux 16 with gcc 5.4.0 (system compiler).
  • macOS 10.11 (El Capitan) with clang 3.7/3.9

The Geant4 toolkit and applications can also be compiled for Intel Xeon Phi systems using the Intel C/C++ Compiler >=16.X. and Intel Manycore Platform Support Stack 3.4. Note that due to a bug in the MPSS GCC compatibility layer, only version 3.4 of MPSS can be used at the time of release. Though we cannot offer full support for the Xeon Phi architecture, a guide discussing our current experience with the platform is available separately.

Prerequisites for Optional Components of Geant4

Geant4 has several optional components which if enabled require further software to be preinstalled on your system. These components and their requirements are listed below.

On Linux, we strongly recommend that you install these through the package management system of your distribution unless these do not meet the version and (for C++ packages) standard requirements listed. You should consult the documentation of your distribution for information on the packages that provide the needed software libraries and headers.

On macOS and Windows, we strongly recommend installing any required packages through binary dmg/exe installers supplied by the vendors of the packages. Installation and use of packages on macOS through Homebrew or MacPorts is not tested or supported, but you may build Geant4 using packages installed through these systems with that caveat.

CLHEP, Expat and zlib Support Libraries

Geant4 distributes minimal versions of the CLHEP , Expat and zlib sources with the toolkit to help cross-platform usage.

These internal versions are built and installed by default (except for Expat on Linux and macOS Platforms), but Geant4 can be configured to use existing installs of these packages if required (see Geant4 Build Options for details). If existing installs are used, they must meet the following version/standard requirements:

  • CLHEP: 2.4.1.0 or higher, compiled against the same C++ Standard as Geant4 (C++11 by default)
  • Expat: 2.0.1 or higher
  • zlib: 1.2.3 or higher

GDML XML Geometry Support

To enable use of geometry reading/writing from GDML XML files, the Xerces-C++ headers and library >=3 must be installed, compiled against the same C++ Standard as Geant4 (C++11 by default)

User Interface and Visualization Drivers

In addition to the packages listed below for individual drivers, we strongly recommend installing the drivers for the video card on your system (e.g. NVIDIA).

  • Qt User Interface and Visualization (All Platforms)
    • Qt4 (>=4.6) or Qt5 headers and libraries
      • On macOS, you should use Qt5.
      • Qt should preferably be compiled against the same C++ Standard as Geant4 (C++11 by default), but this is not required as its ABI is binary compatible between standards.
    • OpenGL or MesaGL headers and libraries.
  • X11 OpenGL Visualization (Linux and macOS)
  • WIN32 OpenGL Visualization (Windows)
    • OpenGL or MesaGL headers and libraries.
    • Visual Studio supplies a basic install of OpenGL.
  • X11 RayTracer Visualization (Linux and macOS)
    • X11 headers and libraries (XQuartz on macOS).
  • Open Inventor Visualization (All Platforms)
    • Coin3D libraries and headers with SoXt(SoWin) graphics binding on Linux/macOS(Windows), compiled against the C++11 standard.
  • Motif User Interface and Visualization (Linux and macOS)

Analysis Features and Backends

The Geant4 analysis library provides a lightweight interface for storing quantities and plots with various backends for persistency (e.g. plain text, XML). Whilst the choice of backend and linking is deferred to the user as required for their application, the following features require presence of additional software when compiling Geant4:

  • Freetype Font Rendering Support (Linux and macOS)

Advanced/Experimental Features

Warning

These features are for advanced users only. Note that HDF5 and Wt support are experimental.

  • VecGeom Replacements for Geant4 solids
    • VecGeom headers and libraries, compiled against the same C++ Standard as Geant4 (C++11 by default)
  • TiMemory profiling for Geant4 kernel and applications
    • TiMemory headers and library, compiled against the same C++ Standard as Geant4 (C++11 by default)
  • HDF5 Persistency for Geant4 Analysis module
    • HDF5 1.8 or higher C headers and libraries.
    • If Geant4 is built with multithreading support, then the used HDF5 install must have been compiled with thread safety enabled.
  • Wt User Interface and Visualization Driver
    • Wt headers and libraries

Software Suggested for Use With Geant4 Applications

Geant4 includes many cross-platform file-based visualization drivers, together with the lightweight inexlib library for basic analysis. Geant4 does not require any additional software over and above that listed in Getting Started to build and install these components.

However, you may wish to install the third-party software suggested below to make use of these components when running your Geant4 application. We again emphasize that you do not need these packages to build and install Geant4. Also note that Geant4 cannot provide support on installing or using these packages. Any issues here should be reported to the developers of the package.

For more details on Geant4’s visualization and analysis components, you should consult the relevant sections in the Geant4 User’s Guide for Application Developers.