Table of contents generated with markdown-toc
You will need recent versions of:
- Cmake (verified to work with version 3.14 and higher)
- ROOT (verified to work with ROOT 6.16 and higher)
You will also need the development libraries for:
- GNU C++ (version 6.2 or higher, though the compilation might work with clang; requires C++11 or higher)
- Xerces-C
The following libraries are optional. If one or more are not present, then GramsSim will compile without the corresponding features. For example, if HepMC3 is not installed, then GramsSky will not be compiled; if Geant4 is not installed, GramsG4 won't be compiled.
- Geant4 (verified to work with Geant4 10.7 and higher)
- HepMC3 (verified to work with HepMC3 3.2.2)
- CFITSIO (verified to work with cfitsio 4.0.0)
- HEALPix (verified to work with healpix_cxx 3.8.0)
The following optional development libraries are needed for Geant4 visualization:
You can fulfill these requirements using conda. This mostly works, though it does not include ROOT I/O in HepMC3 and there are some issues with the Geant4 OpenGL display.
If you have administrative access to your Linux computer system, you can install conda globally. If you don't have administrative access or you prefer it, you can use anaconda3 or miniconda to install conda on your acount locally.
After conda has been installed, the following will set up a suitable development environment:
# Add the conda-forge repository
conda config --add channels conda-forge
conda config --set channel_priority strict
# Create a conda environment. The name "grams-devel" is arbitrary.
conda create -y --name grams-devel compilers cmake root geant4 hepmc3 cfitsio healpix_cxx
Note 1: strict
priority guarantees that the packages you install within an environment will be consistent with one another. However, it does not guarantee that you'll get the latest-and-greatest versions, especially of packages like python
. I've found that conda config --set channel_priority flexible
will get the latest versions of packages, at the potential risk of some package incompatibilities.
Note 2: This conda create
command can take a very long time to execute as it resolves all the package dependencies; I've seen a strict
priority install take days. You may want to consider installing the libmamba solver, which greatly speeds up all conda create
and install
commands.
Afterwards, the following must be executed once per login session:
# Activate the environment to modify $PATH and other variables.
conda activate grams-devel
Another potential solution is to use RPM packages for RHEL-derived Linux distributions (e.g., AlmaLinux, Scientific Linux, CentOS, Oracle Linux).
You will need the EPEL (Extra Packages for Enterprise Linux) repository before you install the main packages required for GramsSim:
sudo dnf config-manager --set-enabled crb
sudo dnf -y install epel-release
# For Oracle Linux 9:
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo dnf -y install root HepMC3-devel HepMC3-rootIO-devel cfitsio-devel
sudo dnf -y install gcc-c++ glibc-devel cmake
-
You will still have to download and build/install Geant4 on your own.
-
You will also have to download and install healpix_cxx separately if you want to be able to input HealPIX maps in GramsSky.
In addition to the EPEL repository, you will need a more recent version of the GCC compiler than comes with CentOS 7. One solution is to use the SCL tools (but see the cautions below).
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum -y install root HepMC3-devel HepMC3-rootIO-devel cfitsio-devel healpix_cxx-devel
sudo yum -y install gcc-c++ glibc-devel cmake3
sudo yum -y install centos-release-scl
# Note that as of Sep-2021 the devtoolsets range from from 7 to 10,
# which corresponds to the major version of GCC they include.
sudo yum -y install devtoolset-7-gcc*
To enable the SCL version of the GCC compiler installed above:
scl enable devtoolset-7 bash
There are problems with this approach:
-
In the compilation instructions, you will want to use
cmake3
instead of justcmake
. -
You will still have to download and build/install Geant4 on your own.
-
It's important that ROOT, HepMC3, and Geant4 all be compiled with a version of the C++ compiler that supports C++11 and above. The ROOT, HepMC3, cfitsio, and healpix_cxx packages from EPEL were compiled with the "native compiler" of CentOS 7, GCC 4.8.5, which does not support C++11.
This page potentially offers a work-around to C++11 incompatibility with older software by adding the following option as shown below when building both Geant4 and GramsSim, but this has not been tested:
cmake3 ../GramsSim -D_GLIBCXX_USE_CXX11_ABI=0
(If you determine the installation commands needed for Debian-style distributions (including Ubuntu), please let wgseligman know so he can update this documentation.)
If you're working on a CentOS 7 system of the Nevis Linux cluster, type
module load cmake root geant4 hepmc3 healpix
and skip to the section below on preparing your local computer. Otherwise, read on.
At Nevis, the approach that fully worked on CentOS 7 was to install recent versions of C++, cmake, ROOT, Geant4, HepMC3, cfitsio, and healpix_cxx by compiling them from source (see Prerequisites above). There was no need to recompile xerces-c, OpenGL, and QT4; the CentOS 7 development packages were sufficient:
sudo yum -y install freeglut-devel xerces-c-devel \
qt-devel mesa-libGLw-devel
Note that compiling Geant4 from source may be the only way to reliably use the OpenGL visualizer.
If you are working remotely (e.g., on a laptop), and you want to use the GramsG4 interactive display, you may also need to install and/or activate both X-Windows and OpenGL for your local computer. You can find instructions here.