catalogue
The first chapter builds and installs Geant4 from the source code
Chapter 2 installing geant4 through package manager
2.2 Homebrew on Mac OS / Linux
2.5 Linux system package manager
2.6 LCG CVMFS version of CentOS7 and Ubuntu Linux
2.6.1 prerequisites for GEANT4 system / software
2.6.2 build and install from source code
2.6.3 rear installation settings
2.6.4 how to use Geant4 Toolkit Library
There are several methods to install Geant4 on the computer through binary package or from scratch. These methods are described below. Which one is available or best for you depends on your operating system and usage needs. In all cases, always use the latest version of Geant4 to ensure the use of the latest bug fixes, features, and help developers and the community provide rapid user support.
The first chapter builds and installs Geant4 from the source code
Geant4 use CMake Configure a build system for compiling and installing package headers, libraries, and support tools from scratch. Follow this method. In order to understand the operating system and software requirements, refer to Geant4 system / software prerequisites (2.6.1), and then build and install from source code (2.6.2).
Although we have made every effort to make this installation method robust and reliable, the numerous platforms and system configurations mean that we cannot guarantee that problems will not be encountered on platforms other than those listed in the support and test platforms.
If there are problems in building and installing Geant4, we welcome you to pass our forum Ask questions and feedback. In order to help us deal with your problem as soon as possible, please include as many details as possible. At a minimum, you should let us know the platform and operating system version, c + + compiler type and version, CMake version, and any error messages. It also helps to list the sequence of commands you use so that we can try to reproduce the problem.
If you think you found a real bug in the construction of Geant4 CMake, please report it to us Bugzilla CMake category on. Like giving forum Like the discovery report, please include as much information as possible so that we can classify bugs and track them quickly. We also welcome general functional requirements and feedback on the system through discover and Bugzilla.
Chapter 2 installing geant4 through package manager
Warning: these packages are not maintained by Geant4 developers, but by assistant members of the community. Please report any installation problems or require the latest version / patch to be packaged through the standard channels of each package manager. If you have packaged Geant4 and want to add it to the list below, please go through our forum contact us.
2.1 Spack on Linux / macOS
Spack of Geant4 package Instructions available for installation:
$ spack install geant4
Spack allows you to install different versions of Geant4 variant , and check their operation:
$ spack info geant4
2.2 Homebrew on Mac OS / Linux
Homebrew of Geant4 formula Instructions available for installation:
$ brew install geant4
2.3 Conda on Linux/macOS
One for Geant4 Conda package Can pass Conda -forge And can be installed into the environment through the following instructions:
$ conda create -c conda-forge --name <my-environment> geant4 $ conda activate <my-environment>
For further information and support, please check the relevant Source code.
2.4 Macports
MacPorts Provides for Geant4 One port , you can install with the following instructions:
$ sudo port install geant4
2.5 Linux system package manager
Some Linux distributions provide Geant4 through their system package manager (directly or through the community repository). Repology Provide partial list and detailed information links:
-Named geant4 My bag
-Named geant (but please note that "4" in "Geant4" is not part of this version!)
2.6 LCG CVMFS version of CentOS7 and Ubuntu Linux
If your platform is available or installed CVMFS Then, Geant4 can pass the SFT from CentOS7 cern. Of the ch repository LCG version get. Ubuntu 18.04/20.04 software is available in a few versions.
2.6.1 prerequisites of GEANT4 system / software
Operating system / software prerequisites
The following source code / software must exist to build / install Geant4 or use it to develop applications:
-Geant4 Toolkit source code.
-C + + compiler and standard library supporting C++11 standard:
-Linux: GNU Compiler Collection 4.9.3 or later.
* it is strongly recommended to use the GCC compiler provided by the distributed package management system unless it does not meet the minimum version requirements.
-macOS: Apple Clang (Xcode )11 or later.
* you must also install the command line tool by running Xcode select -- install from the terminal.
-Windows: Visual Studio 2019, community edition or later.
The compiler and standard library need to support at least the following features of the C++11 standard:
– template alias, as defined in N2258.
– automatic type derivation, as defined in N1984.
– delegate constructor, as defined in N1986.
– enumerate forward declarations, as defined in N2764.
– explicit conversion operators, as defined in N2437.
– override control final keywords, as defined in N2928, N3206 and N3272.
– Lambda function, as defined in N2927.
– null pointer, as defined in N2431.
– Override control Override keywords, as defined in N2928, N3206 and N3272.
– range based, as defined in N2930.
– strongly typed enumeration, as defined in N2347.
– unified initialization, as defined in N2640.
-CMake 3.8 or later.
On Linux, we recommend that you use the CMake provided by the distribution's package management system unless it does not meet the minimum version requirements. In this case, we recommend that you install CMake using the latest version of the Linux binary installer available from Kitware Download the site for instructions. This installer is highly portable and should be suitable for most distributions.
On macOS and Windows, CMake is not installed by default, so we recommend you use it Kitware Download the latest Darwin64 dmg (macOS) or Win32 exe (Windows) installer provided at the site for installation. On macOS, you can also use Homebrew or Macports Package manager to install the required version.
For more information about CMake, see CMake help and documentation.
Support and test platform
Geant4 officially supports the following operating system and compiler combinations:
-CentOS 7 Linux with GCC >=4.9.3, >=5.4, >=6.3, >=7.3, >= 8.2, >= 9.2, >= 10.2 64bit.
Free Developer Toolset The package installs the required minimum GCC version on the CentOS7 system.
Geant4 has been successfully compiled on other Linux distributions, including Debian, Ubuntu and openSUSE. It is mainly required that the system has sufficient versions of GCC to support the installation of C++11. Please note that distributions other than CentOS are not officially supported. However, feedback and patches from non CentOS platforms are welcome!
-macOS 11.0 (Big Sur), 10.15 (Catalina), 10.14 (Mojave), with Apple-LLVM (Xcode) 11,12, 64 bit.
Big Sur support is preliminary, as is the support for Apple M1 chip.
-Windows 10 and Visual Studio 2019 , 32 / 64 bit.
At present, there is no official support for building / using Geant4 through the Windows subsystem of Linux, but we welcome it through our Discourse Forum Report or feedback on the use of Geant4 under this system.
The following platforms and compilers have also been tested but not officially supported:
-CentOS 7 Linux and Intel C/C + + compiler > = 19 X. Note that the Intel compiler must be set up to use the C + + header files and standard libraries provided by GNU GCC > = 4.9 to provide the required compatibility with the C++11 standard.
-CentOS 7 Linux with LLVM/Clang 7, 8, and 9
-CentOS 8 Linux with GCC 8 and 10
-Ubuntu Linux 18.04LTS and GCC 7 (system compiler)
-Ubuntu Linux 20.04LTS and GCC 9 (system compiler)
Prerequisites for Geant4 optional components
Geant4 has several optional components. If you enable these components, you need to pre install more software on your system. These components and their requirements are listed below.
On Linux, we strongly recommend that you install these through the distribution's package management system, unless they do not meet the listed versions and (for C + + packages) standards. You should consult the documentation for your distribution for information about the packages that provide the required libraries and header files.
On macOS and Windows, we strongly recommend that you install any necessary packages through the binary dmg/exe installer provided by the package vendor. Failed the test Homebrew or MacPorts Install and use packages on macOS, but you can build Geant4 using packages installed through these systems, but you need to pay attention.
CLHEP, Expat, and zlib support libraries
Geant4 distribution using Toolkit CLHEP,Expat and zlib The minimum version of the source to help cross platform use.
These builds are built and installed by default (except Expat on Linux and macOS platforms), but Geant4 can be configured to use an existing installation of these packages if necessary (see Geant4 build options for details). If using existing installations, they must meet the following versions / standards:
-CLHEP: version 2.4.4.0 or later, compiled according to the same C + + standard as Geant4 (C++11 by default).
-Expat: version 2.0.1 or later.
-zlib: 1.2.3 or later.
GDML XML geometry support
To enable reading / writing geometry from GDML XML files, you must install Xerces-C++ headers and library >=3, and compile according to the same C + + standard as Geant4 (C++11 by default). On Unix systems, it should also be configured and built using netaccessor curl, and the libcurl used should support SSL to access schema files through https.
User interface and visualization drivers
In addition to the driver packages listed below, we strongly recommend that you install a graphics card driver (such as NVIDIA) on your system.
For the following X11 based drivers, users of the Wayland window manager will need XWayland. Our experience is that this solution does work with Qt.
-Qt5 user interface and visualization (all platforms)
–Qt5 header files and libraries
* you need to register as an open software developer to get a free personal version of Qt.
* for most platforms, you can get binary installation packages.
* if the Qt5 module is installed separately, the settings required by Geant4 are Qt5Core, Qt5Gui, qt5widgets, qt5opengl and Qt5PrintSupport. Using the optional and experimental Qt3D driver also requires qt5.15 and Qt53DCore, Qt53DExtras and Qt53DRender modules.
* if you need to compile, Qt5 is best compiled using the same C + + standard as Geant4 (C++11 by default), but this is not necessary because its ABI is binary compatible between standards.
– OpenGL or MesaGL Header files and libraries.
-X11 OpenGL visualization (Linux and macOS)
– X11 header files and libraries( XQuartz on macOS).
– OpenGL or MesaGL Header files and libraries.
-WIN32 OpenGL visualization (Windows)
– OpenGL or MesaGL Header files and libraries.
– Visual Studio provides a basic installation of OpenGL.
-X11 RayTracer visualization (Linux and macOS)
– X11 header files and libraries( XQuartz on macOS).
-Open Inventor visualization (all platforms)
– Coin3D Library and header files, version 4.0.0 or later, plus a binding:
– SoXt Library and header files, version 1.4.0 or later
– SoQt Library and header files, version 1.6.0 or later
– SoWin Library and header files, version 1.4.0 or later (SoWin support is temporary)
– see also installing Coin3D and SoXt/Qt bindings
-Motif user interface and visualization (Linux and macOS)
– Motif Topic titles and libraries.
– X11 header files and libraries( XQuartz on macOS).
– OpenGL or MesaGL Header files and libraries.
Analysis capabilities and backend
The Geant4 analysis library provides a lightweight interface for storing quantities and drawings with various back ends (such as plain text, XML). Although the selection of backend and links is deferred to users according to the needs of their applications, the following functions require the existence of additional software when compiling Geant4:
-Freetype font rendering support (Linux and macOS)
– Freetype Headers and libraries.
Python binding
Python bindings with Geant4 and Geant4Py can now be built as part of the main Geant4 build, and need to:
-Python 3.X interpreter, library and header files
-Boost Python 1.69 library and header files, compiled / linked according to the required Python version.
Advanced / experimental features
Warning: these features are only available for advanced users. Please note that the use of HDF5 is experimental.
-VecGeom alternatives for Geant4 entities
– VecGeom Header files and libraries, version 1.1.8 or later, compiled according to the same C + + standard as Geant4
(the default is C++11)
-TiMemory analysis for Geant4 kernel and Applications
– TiMemory Header files and libraries are compiled according to the same C + + standard as Geant4 (C++11 by default)
-HDF5 persistence of Geant4 analysis module
– HDF5 1.8 or later C header files and libraries.
– if Geant4 is built with multithreading support, the HDF5 installation used must have been compiled with thread safety enabled.
Recommended software for Geant4 applications
Geant4 includes many file based cross platform visualization drivers, as well as lightweight for basic analysis inexlib Library. Apart from those listed in the Geant4 system / software prerequisites, Geant4 does not require any additional software to build and install these components.
However, you may want to install the third-party software recommended below to use these components when running your Geant4 application. Again, we emphasize that you don't need these packages to build and install Geant4. Also note that Geant4 does not provide support for installing or using these packages. Any problems here should be reported to the developer of the package.
-DAWN postscript renderer (used with the DAWN visualization driver).
-HepRApp browser (used with HepRepFile visualization driver).
-WIRED4 JAS Plug in (used with HepRepXML visualization driver).
-VRML browser (used with VRML visualization driver).
-OpenScientist Interactive analysis environment.
-AIDA implementation, such as O penScientist, JAS3 or rAIDA.
-For Geant4 medical simulation gMocren Volume visualizer.
For more details on the Geant4 visualization and analysis components, you should consult the relevant section of the Geant4 user's Guide for application developers.
2.6.2 build and install from source code
On Unix platform
The Geant4 source package Geant4 10.07. tar. GZ extract to a location of your choice. For illustration only, this guide assumes that it has been extracted into a directory named / path/to, so the Geant4 source package is located in a subdirectory
/path/to/geant4.10.07
We call this directory the source directory. The next step is to create a directory in which to configure and run the build and store the build products. This directory should not be the same as or within the source directory. In this guide, we create this build directory next to the source directory:
$ cd /path/to $ mkdir geant4.10.07-build $ ls geant4.10.07 geant4.10.07-build
To configure a build, switch to the build directory and run CMake:
$ cd /path/to/geant4.10.07-build $ cmake -DCMAKE_INSTALL_PREFIX=/path/to/geant4.10.07-install /path/to/geant4.10.07
Here, the CMake variable CMAKE_INSTALL_PREFIX is used to set the installation directory, that is, the directory where the Geant4 library, header files and support files are installed. It must be provided as an absolute path. The second parameter to CMake is the path to the source directory. In this example, we use the absolute path of the source directory, but you can also use the relative path from the build directory to the source directory.
Additional parameters can be passed to CMake to activate optional components of Geant4, such as visualization drivers, or to adjust build and install parameters. For more information about these options, see Geant4 build options. If you run CMake and later decide to activate other options, simply rerun CMake in the build directory, passing the additional options and the build directory path to it. For example, after running CMake as above, you may want to activate the installation of the Geant4 dataset, so you will run (in the build directory)
$ cd /path/to/geant4.10.07-build $ cmake -DGEANT4_INSTALL_DATA=ON
When the CMake command is executed, it runs to configure the build and generates a Unix Makefile to perform the actual build. CMake can generate build scripts for other tools, such as Eclipse and Xcode, but please note that we do not support users to install Geant4 using these tools. On Linux, you will see output similar to the following:
$ cmake -DCMAKE_INSTALL_PREFIX=/path/to/geant4.10.07-install /path/to/geant4.10.07 -- The C compiler identification is GNU 4.9.2 -- The CXX compiler identification is GNU 4.9.2 -- Check for working C compiler: /usr/bin/gcc-4.9 -- Check for working C compiler: /usr/bin/gcc-4.9 -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/g++-4.9 -- Check for working CXX compiler: /usr/bin/g++-4.9 -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found EXPAT: /usr/lib64/libexpat.so (found version "2.0.1") -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of off64_t -- Check size of off64_t - done -- Looking for fseeko -- Looking for fseeko - found -- Looking for unistd.h -- Looking for unistd.h - found -- Pre-configuring dataset G4NDL (4.6) -- Pre-configuring dataset G4EMLOW (7.13) -- Pre-configuring dataset PhotonEvaporation (5.7) -- Pre-configuring dataset RadioactiveDecay (5.6) -- Pre-configuring dataset G4PARTICLEXS (3.1) -- Pre-configuring dataset G4PII (1.3) -- Pre-configuring dataset RealSurface (2.2) -- Pre-configuring dataset G4SAIDDATA (2.0)) -- Pre-configuring dataset G4ABLA (3.1) -- Pre-configuring dataset G4INCL (1.0) -- Pre-configuring dataset G4ENSDFSTATE (2.3) *WARNING* Geant4 has been pre-configured to look for datasets in the directory: /path/to/geant4.10.07-install/share/Geant4-10.7.0/data but the following datasets are NOT present on disk at that location: G4NDL (4.6) G4EMLOW (7.13) PhotonEvaporation (5.7) RadioactiveDecay (5.6) G4PARTICLEXS (3.1) G4PII (1.3) RealSurface (2.2) G4SAIDDATA (2.0)) G4ABLA (3.1) G4INCL (1.0) G4ENSDFSTATE (2.3) If you want to have these datasets installed automatically simply re-run cmake and set the GEANT4_INSTALL_DATA variable to ON. This will configure the build to download and install these datasets for you. For example, on the command line, do: cmake -DGEANT4_INSTALL_DATA=ON <otherargs> The variable can also be toggled in ccmake or cmake-gui. If you're running on a Windows system, this is the best solution as CMake will unpack the datasets for you without any further software being required Alternatively, you can install these datasets manually now or after you have installed Geant4. To do this, download the following files: https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4NDL.4.6.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4EMLOW.7.13.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4PhotonEvaporation.5.7.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4RadioactiveDecay.5.6.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4PARTICLEXS.3.1.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4PII.1.3.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4RealSurface.2.2.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4SAIDDATA.2.0.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4ABLA.3.1.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4ENSDFSTATE.2.3.tar.gz and unpack them under the directory: /path/to/geant4.10.07-install/share/Geant4-10.7.0/data As we supply the datasets packed in gzipped tar files, you will need the 'tar' utility to unpack them. Nota bene: Missing datasets will not affect or break compilation and installation of the Geant4 libraries. -- The following Geant4 features are enabled: GEANT4_USE_SYSTEM_EXPAT: Using system EXPAT library -- Configuring done -- Generating done -- Build files have been written to: /path/to/geant4.10.07-build
The exact output will vary depending on the platform / compiler used, but the last three lines should be the same as the path difference. These indicate that the configuration was successful.
The warning message about the dataset is just a suggestion. Due to the size of the dataset, GEANT4 will try to reuse any dataset it can find under the data installation prefix, in our example / path / to / GEANT4 10.07-install/share/Geant4-10.7.0/data. If no dataset is found here, it will pre configure the installation script using GEANT4 (described in the post installation) to point to the location and send a message to advise you of the steps required to manually install the dataset at your convenience.
Building Geant4 does not require a dataset, but it may be required to run your application, depending on the physical model you use. If you want to automatically download and install datasets when building Geant4, just add the option - dgeant4_ INSTALL_ Add data = on to the parameter passed to CMake. Note that this requires a valid network connection and will download approximately 0.5GB of data. If you already have datasets on your system, you can point Geant4 to their location. For more details, see Geant4 described in standard options_ INSTALL_ DataDir option.
If you see any errors at this time, please carefully check the error message output by CMake and first check the installation of your CMake and C + + compiler. The default configuration of Geant4 is very simple. As long as CMake and compiler are installed correctly, there will be no errors.
After the configuration runs, CMake will generate a Unix Makefile for building Geant4. To run a build, simply execute make in the build directory:
$ make -jN
Where N is the number of parallel jobs you need (for example, if your machine has a dual core processor, you can set N to 2).
The build will now run and output information about the progress of the build and the current operation. If you need more output to help solve the problem or just for information, run make as follows:
$ make -jN VERBOSE=1
After the build is complete, you can install Geant4 into your previous cmake by running the following command_ INSTALL_ In the directory specified in prefix:
$ make install
In the build directory. Libraries, header files, and resource files are installed under the installation prefix you select in the standard Unix style directory hierarchy, as described in post installation below. If you perform a phased installation for packaging or deployment, the Makefile generated by CMake supports copying the DESTDIR variable to a temporary location. To uninstall Geant4, you can run:
$ make uninstall
This will delete all installed files, but will not delete any installed directories.
On Windows Platforms
The easiest way to build and install Geant4 from source code on Windows platform is to use windows command line program cmd and CMake command line interface to MSBuild tool provided by Visual Studio. Although the complete Visual Studio GUI can be used, cmd and CMake/MSBuild provide a simpler interface, and commands can be used in scripts. You can also use it if you like PowerShell Instead of cmd, the following description should be transferred, unless there are slight syntax differences. Geant4 builds using Cygwin or MinGW and their own compilers or Microsoft C + + compilers are neither supported nor tested, although CMake systems are expected to work under these tool chains. If you use these tools through their native shell and their own version of CMake, you can use the instructions for building and installing on the Unix platform.
To ensure that the appropriate Visual Studio path and settings are set for the build, from Start → Visual Studio 201X → Visual Studio Tools → Developer Command Prompt for VS201X. After running this command, confirm that you have an available MSVC compiler by running the cl command, and you should see (note that below, for clarity, the cmd prompt is displayed as >):
> cl Microsoft (R) C/C++ Optimizing Compiler Version 19.11.25547 for x86 Copyright (C) Microsoft Corporation. All rights reserved. usage: cl [ option... ] filename... [ /link linkoption... ]
The exact version number of cl may vary slightly, but for Visual Studio 2019, the first element of the compiler version should be at least 19.
To start building Geant4, add the source package Geant4_ 10_ Unzip 07.zip to the location of your choice. For illustration only, this guide assumes that it has been extracted into the directory named C:\Users\YourUsername\Geant4, so the Geant4 source package is located in the subdirectory C:\Users\YourUsername\Geant4\geant4_10_07
We call this directory the source directory. The next step is to create a directory in which to configure and run the build and store the build products. This directory should not be the same as or within the source directory. In this guide, we create this build directory next to the source directory:
> cd %HOMEPATH%\Geant4 > dir /B geant4_10_07 > mkdir geant4_10_07-build > dir /B geant4_10_07 geant4_10_07-build To configure the build, change into the build directory and run CMake: > cd %HOMEPATH%\Geant4\geant4_10_07-build > cmake -DCMAKE_INSTALL_PREFIX="%HOMEPATH%\Geant4\geant4_10_07-install" "%HOMEPATH%\Geant4\geant4_10_07"
Here, the CMake variable CMAKE_INSTALL_PREFIX is used to set the installation directory, that is, the directory where the Geant4 library, header files and support files are installed. It must be provided as an absolute path. The second parameter to CMake is the path to the source directory. In this example, we use the absolute path of the source directory, but you can also use the relative path from the build directory to the source directory. If paths contain spaces, they should be referenced.
Additional parameters can be passed to CMake to activate optional components of Geant4, such as visualization drivers, or to adjust build and install parameters. For more information about these options, see Geant4 build options. If you run CMake and later decide to activate other options, simply rerun CMake in the build directory and pass the additional options and build directory to it. For example, after running CMake as above, you may want to activate the installation of the Geant4 dataset, so you will run
> cd %HOMEPATH%\Geant4\geant4_10_07-build > cmake -DGEANT4_INSTALL_DATA=ON .
When the CMake command is executed, it runs to configure the build and generates a Visual Studio project file to perform the actual build. CMake can generate build scripts for other tools, such as NMake and Ninja, but note that these are not yet supported by Geant4 builds on Windows. Using Visual Studio, you should see something like
> cmake -DCMAKE_INSTALL_PREFIX="%HOMEPATH%\Geant4\geant4_10_07-install" "%HOMEPATH%\Geant4\geant4_10_07" -- Building for: Visual Studio 15 2017 -- The C compiler identification is MSVC 19.11.25547.0 -- The CXX compiler identification is MSVC 19.11.25547.0 -- Check for working C compiler: C:/Program Files (x86)/Microsoft VisualStudio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x86/cl.exe -- Check for working C compiler: C:/Program Files (x86)/Microsoft VisualStudio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x86/cl.exe --works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft VisualStudio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x86/cl.exe -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft VisualStudio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x86/cl.exe --works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for dlfcn.h -- Looking for dlfcn.h - not found -- Looking for fcntl.h -- Looking for fcntl.h - found -- Looking for inttypes.h -- Looking for inttypes.h - found -- Looking for memory.h -- Looking for memory.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stdlib.h -- Looking for stdlib.h - found -- Looking for strings.h -- Looking for strings.h - not found -- Looking for string.h -- Looking for string.h - found -- Looking for sys/stat.h -- Looking for sys/stat.h - found -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for unistd.h -- Looking for unistd.h - not found -- Looking for getpagesize -- Looking for getpagesize - not found -- Looking for bcopy -- Looking for bcopy - not found -- Looking for memmove -- Looking for memmove - found -- Looking for mmap -- Looking for mmap - not found -- Looking for 4 include files stdlib.h, ..., float.h -- Looking for 4 include files stdlib.h, ..., float.h - found -- Check if the system is big endian -- Searching 16 bit integer -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of unsigned short -- Check size of unsigned short - done -- Using unsigned short -- Check if the system is big endian - little endian -- Looking for off_t -- Looking for off_t - not found -- Looking for size_t -- Looking for size_t - not found -- Check size of off64_t -- Check size of off64_t - failed -- Looking for fseeko -- Looking for fseeko - not found -- Looking for unistd.h -- Looking for unistd.h - not found -- Pre-configuring dataset G4NDL (4.6) -- Pre-configuring dataset G4EMLOW (7.13) -- Pre-configuring dataset PhotonEvaporation (5.7) -- Pre-configuring dataset RadioactiveDecay (5.6) -- Pre-configuring dataset G4PARTICLEXS (3.1) -- Pre-configuring dataset G4PII (1.3) -- Pre-configuring dataset RealSurface (2.2) -- Pre-configuring dataset G4SAIDDATA (2.0)) -- Pre-configuring dataset G4ABLA (3.1) -- Pre-configuring dataset G4INCL (1.0) -- Pre-configuring dataset G4ENSDFSTATE (2.3) *WARNING* Geant4 has been pre-configured to look for datasets in the directory: /Users/YourUsername/Geant4/geant4_10_07-install/share/Geant4-10.7.0/data but the following datasets are NOT present on disk at that location: G4NDL (4.6) G4EMLOW (7.13) PhotonEvaporation (5.7) RadioactiveDecay (5.6) G4PARTICLEXS (3.1) G4PII (1.3) RealSurface (2.2) G4SAIDDATA (2.0)) G4ABLA (3.1) G4INCL (1.0) G4ENSDFSTATE (2.3) If you want to have these datasets installed automatically simply re-run cmake and set the GEANT4_INSTALL_DATA variable to ON. This will configure the build to download and install these datasets for you. For example, on the command line, do: cmake -DGEANT4_INSTALL_DATA=ON <otherargs> The variable can also be toggled in ccmake or cmake-gui. If you're running on a Windows system, this is the best solution as CMake will unpack the datasets for you without any further software being required Alternatively, you can install these datasets manually now or after you have installed Geant4. To do this, download the following files: https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4NDL.4.6.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4EMLOW.7.13.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4PhotonEvaporation.5.7.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4RadioactiveDecay.5.6.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4PARTICLEXS.3.1.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4PII.1.3.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4RealSurface.2.2.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4SAIDDATA.2.0.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4ABLA.3.1.tar.gz https://cern.ch/geant4\unhbox\voidb@x\kern\z@\char'\protect\ discretionary{\char\defaulthyphenchar}{}{}data/datasets/G4ENSDFSTATE.2.3.tar.gz and unpack them under the directory: /Users/YourUsername/Geant4/geant4_10_07-install/share/Geant4-10.7.0/data As we supply the datasets packed in gzipped tar files, you will need the 'tar' utility to unpack them. Nota bene: Missing datasets will not affect or break compilation and installation of the Geant4 libraries. -- The following Geant4 features are enabled: -- Configuring done -- Generating done -- Build files have been written to: C:/Users/YourUsername/Geant4/geant4_10_04-build
The output of Visual Studio 2019 will be slightly different, and the source / build path is for illustration only, but the last three lines should be at least the same within the path difference. These indicate that the configuration was successful.
The warning message about the dataset is just a suggestion. Due to the size of the dataset, GEANT4 will try to reuse any dataset it can find under the data installation prefix, which in our example is C:\Users\YourUsername\Geant4\geant4_10_07-install\share\Geant4-10.7.0\data . If no datasets are found here, a message is issued to inform you of the steps required to manually install the datasets at your convenience.
Building Geant4 does not require a dataset, but it may be required to run your application, depending on the physical model you use. If you want to automatically download and install datasets when building Geant4, just add the option - dgeant4_ INSTALL_ Add data = on to the parameter passed to CMake. Note that this requires a valid network connection and will download approximately 0.5GB of data. If you already have datasets on your system, you can point Geant4 to their location. For more details, see Geant4 described in standard options_ INSTALL_ DataDir option.
If you see any errors at this time, please carefully check the error message output by CMake and first check the installation of CMake and Visual Studio. The default configuration of Geant4 is very simple. As long as CMake and Visual Studio are installed correctly, you should not see errors.
After the configuration runs, CMake generates a Visual Studio solution file for building Geant4. CMake itself can be used to run a build by executing the following command:
> cmake --build . --config Release
Here, the - build parameter takes the path to the build directory. In this case, we run from the build directory, so it is only the current working directory-- The config parameter takes the configuration we want to build (unlike Make, Visual Studio can support multiple configurations in the same project) and selects Release to provide a fully optimized library for optimal performance. If you are developing an application and need debugging information, you should change this parameter to RelWithDebInfo.
The build will now run and output information about the progress of the build and the current operation. By default, Visual Studio solutions do not enable parallel compilation of files to speed up construction. The CMake system of Geant4 provides an option to enable it, so if you have a multi-core system, you can change the option - DGEANT4_BUILD_MSVC_MP=ON is added to the parameter passed to CMake. After the build is complete, you can install header files, libraries, and support files by running the following command:
> cmake --build . --config Release --target install
You can also call this command immediately after configuration to build and install Geant4 in one step. The file and directory structure of the installation follows the file and directory structure built by Unix and is described in the post installation installer.
Geant4 build options
The minimum program for building and installing Geant4 on these platforms is provided on both Unix and Windows platforms. Many additional options can be passed to CMake to adjust how Geant4 is built and installed, and to enable optional components.
Options are divided into standard options, which can be set directly by any user or developer. Advanced options are generally required by only advanced users and developers, or very fine control of construction and installation. Some options require external software for Geant4 enabled components (as listed in Geant4 system / software prerequisites). If these options are enabled, the required software will be searched, so there are also options to control where CMake should find these packages. If the required package is not found, CMake exits with an error message detailing what was not found.
These options can be set by passing their names and values to the cmake command with the - D flag. For example:
$ cmake -DCMAKE_INSTALL_PREFIX=/opt/geant4 -DGEANT4_USE_GDML=ON /path/to/geant4-source
The build of Geant4 will be configured to install and compile GDML support under / opt/geant4.
If you have created a build directory and used CMake to configure the build, you can always rerun CMake in that directory with the new option to regenerate the build scripts (Makefiles or IDE solutions). You can also deactivate previously selected options to remove components from the build. For example, if we configure a build to enable GDML support and want to remove it, we can run:
$ cmake -DGEANT4_USE_GDML=OFF .
Note that this assumes that we are running cmake in the previously configured build directory, so we only need to pass the current working directory instead of the full source directory path.
If you reconfigure to unset options and rebuild and reinstall, your installation may contain files installed by previously set options (such as titles). In this case, you should build the uninstall target before reconfiguration to ensure that these files are deleted.
CMake also provides a terminal / GUI interface based on curves (UNIX only) and Qt (UNIX and Windows), which can be used to browse and set options. For more information about these interfaces, see the CMake documentation.
Standard options