Warning, /east/docs/_content/installation.md is written in an unsupported language. File is not indexed.
0001 ---
0002 title: "Installation"
0003 layout: base
0004 name: installation
0005
0006 tables:
0007 g4options:
0008 headers: [Option, Comment]
0009 rows:
0010 # - [
0011 # "GEANT4_BUILD_MULTITHREADED",
0012 # "-"
0013 # ]
0014 - [
0015 "GEANT4_USE_GDML",
0016 'Requires <a href="http://xerces.apache.org/xerces-c/" target="_blank"><em>Xerces-C++</em></a> parser.'
0017 ]
0018 - [
0019 "GEANT4_USE_OPENGL_X11",
0020 "Requires <em>X11</em> and <em>OpenGL</em> libraries."
0021 ]
0022 - [
0023 "GEANT4_USE_QT",
0024 "Requires <em>Qt5</em> and <em>OpenGL</em> libraries."
0025 ]
0026 - [
0027 "GEANT4_INSTALL_DATA",
0028 "Installs datasets."
0029 ]
0030 ---
0031 <h1>Installation</h1>
0032 * TOC
0033 {:toc}
0034
0035 ---
0036
0037 ## GEANT4
0038
0039 ### Installation
0040
0041 * __eAST__ runs on top of the latest public version of Geant4, so before building eAST you need to install __Geant4__.
0042 The current Geant4 version is [11.1.0](https://geant4.web.cern.ch/support/download){:target="_blank"} -- use
0043 this link to download and install.
0044 * Please refer to [the Geant4 installation guide](https://geant4-userdoc.web.cern.ch/UsersGuides/InstallationGuide/html/index.html){:target="_blank"}
0045 and follow all instructions.
0046 In many cases (e.g. if the platform is Debian) Geant4 will need to
0047 be [installed from source](https://geant4-userdoc.web.cern.ch/UsersGuides/InstallationGuide/html/installguide.html){:target="_blank"}.
0048 * The process involves using `cmake`, and it's
0049 important that you use a proper _build directory_ as recommended in the installation guide.
0050 Please see the _CMake options_ section below for details on options.
0051 * Before you commence the build please make sure that the compilers i.e. `gcc` and `g++` are in the $PATH
0052 and their versions comply with GEANT requirements.
0053 * `cmake` will produce helpful diagnostics if some dependencies are missing, in which case these
0054 will need to be installed (see the table and Appendix below). In case of this and other errors when
0055 using `cmake` the safest option is clean up the "build" directory and
0056 start the build procedure from scratch.
0057 * During the build process certain files will be downloaded automatically from remote servers,
0058 so make sure your computer is online at that time.
0059 * If the __install path__ is in a folder to which the user doesn't have _write_ access (e.g. under "opt"), one may need to use root/chown or `sudo` to get necessary privileges.
0060 * There is a [post-installation step](https://geant4-userdoc.web.cern.ch/UsersGuides/InstallationGuide/html/postinstall.html){:target="_blank"} that should be followed to set the environment variables important for Geant4 operation.
0061
0062
0063 ### CMake options
0064
0065 *In order to successfuly build eAST it is mandatory that you set the options listed below when using `cmake` to build Geant4*.
0066 As you can see from the table, if you start from scratch you may need to install the prerequisits first such as
0067 <em>X11, Qt5, OpenGL and Xerces-C++</em> libraries.
0068 Please see the [Appendix](/content/installation.html#appendix) for comments and some practical
0069 advice about how to proceed.
0070
0071 <table border="1" width="60%">
0072 <tr>
0073 {% for header in page.tables.g4options.headers %}
0074 <th>{{ header }}</th>
0075 {% endfor %}
0076 </tr>
0077 {% for row in page.tables.g4options.rows %}
0078 <tr>
0079 {% for item in row %}
0080 <td>
0081 {{ item }}
0082 </td>
0083 {% endfor %}
0084 </tr>
0085 {% endfor %}
0086 </table>
0087
0088 <p/>
0089
0090 A command line for ```cmake``` using these options might look like this:
0091 ```bash
0092 cmake -DCMAKE_INSTALL_PREFIX=/install/path -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_GDML=ON -DGEANT4_USE_QT=ON /path/to/geant/directory
0093 ```
0094
0095 In certain cases (not very common) the user may need to build a version of Geant4 where
0096 multithreading is disabled. One such cases is creation of Python bindings on certain platforms.
0097 In such cases, the following option will need to be added:
0098
0099 ```bash
0100 -DGEANT4_BUILD_MULTITHREADED=OFF
0101 ```
0102
0103
0104 ---
0105
0106 ## Setting up eAST
0107
0108 ### Build and Install
0109 * It is recommended that the user creates a `build` folder inside the main eAST directory; the example below assumes that this is the case
0110 * During the build proccess, additional files may be downloaded, so internet access is required
0111 * To customize the installation location, use the `CMAKE_INSTALL_PREFIX` option (see below)
0112 * When building eAST `cmake` will attempt to find an existing HepMC3 installation in default locations
0113 * A more reliable method is to specify the correct location with the `HepMC3` option (see below)
0114
0115 The following is a working example of commands for the build and install
0116 procedure (assuming they are run from the eAST directory):
0117
0118 ```bash
0119 cmake -DCMAKE_INSTALL_PREFIX=/path/to/installdir -DHepMC3=~/path/to/HepMC3dir/ -S . -B build
0120 cmake --build build
0121 cmake --install build
0122 ```
0123
0124 The last command will copy libraries, binaries, data, and cmake configuration files into the
0125 predefined install location.
0126 If you elect to install into a system directory (e.g. under `/opt` etc) please see the notes
0127 in the Geant4 section above, regarding correct permissions.
0128 After installation has completed you probably want to ensure that (in this example) `/path/to/installdir/bin`
0129 is in the `$PATH` environment variable and `/path/to/installdir/lib` in `$LD_LIBRARY_PATH`.
0130
0131 ### HepMC3
0132
0133 Many use cases involve using the HepMC3 libraries so it is effectively a prerequisite for eAST.
0134 This is also implied in the build option illustrated in the previous section (cf. `-DHepMC3`).
0135 Please visit
0136 [the HepMC3 page](https://gitlab.cern.ch/hepmc/HepMC3/-/tree/master/){:target="_blank"}
0137 if you need to install HepMC3 from binaries or build it from source. When downloading the tar
0138 file as per instructions, it is possible that the link is stale, so the version number will
0139 need to be adjusted to point to an existing file.
0140
0141 ### Final steps
0142
0143 Once the HepMC3 installation is complete (or is already in place), in order for eAST to work,
0144 the environment variable `LD_LIBRARY_PATH` will need to be updated to include the
0145 path the the HepMC3 libraries. This can be done after sourcing the Geant4
0146 [post-installation script](https://geant4-userdoc.web.cern.ch/UsersGuides/InstallationGuide/html/postinstall.html){:target="_blank"}.
0147
0148 ---
0149
0150 ## Appendix
0151
0152 ### GEANT4 dependencies
0153
0154 #### Xerces
0155
0156 The [Xerces build and intallation webpage](https://xerces.apache.org/xerces-c/build-3.html#UNIXl){:target="_blank"}
0157 mentions cmake -- although the latter is not explicitly invoked, and you only need to run `configure` and `make`.
0158 Read the web page carefully.
0159
0160 #### Qt
0161
0162 The Qt installation procedure has evolved over the years. Using the GUI installer
0163 provided by the developer appears to frequently cause problems. At the time of writing,
0164 this procedure is working:
0165
0166 ```bash
0167 # prerequisites:
0168 sudo apt-get -y install build-essential openssl libssl-dev libssl1.0 libgl1-mesa-dev libqt5x11extras5
0169 # qt:
0170 sudo apt-get install qtbase5-dev
0171 sudo apt-get install qtdeclarative5-dev
0172 ```
0173 #### libxmu
0174
0175 ```bash
0176 sudo apt-get install -y libxmu-dev
0177 ```
0178
0179 #### Passing options to "make"
0180
0181 On many Linux platforms, `cmake` is relying on `make` for the build step.
0182 It is possible in these cases to pass helpful options (such as use multiple cores
0183 for compilation) to `make` by setting an environment variable:
0184
0185 ```bash
0186 export MAKEFLAGS=-j4
0187 ```
0188
0189 ### Running Geant4 graphics under WSL2
0190
0191 In some cases an extra step is needed to get the graphics driver to work correctly,
0192 for example in WSL2 the following setting is helpful:
0193
0194 ```bash
0195 export LIBGL_ALWAYS_INDIRECT=
0196 ```
0197
0198