Here below, you will find instructions on how to compile the GeoModel libraries from scratch. You can want to do that for different reasons:
Here below, you will find instructions on how to compile all the GeoModel libraries and tools, and their main dependencies, from sources. You may want to do that for different reasons:
- you want to build the libraries for an OS which is not officially supported or for a version of it for which no pre-compiled packages are provided (for info, see the [Start](../start/) section)
- you want to build the libraries for an OS which is not officially supported or for a version of it for which no pre-compiled packages are provided (for info, see the [Start](../start/install.md) section)
- you want to test the latest version of the code
- you want to contribute to the development of the libraries
- you want to contribute to the development of the GeoModel libraries and tools
In the following, you will find basic strategies to effectively build the GeoModel software stack, based on different use cases.
In the following, you will find basic strategies to effectively build the GeoModel libraries, based on different use cases. For more details, you can find updated and additional instructions inside the `README` file of the [GeoModelVisualization/README.md](https://gitlab.cern.ch/GeoModelDev/geomodelvisualization/-/blob/master/README.md) specific package.
## System Dependencies
### Compilers
In the GeoModel packages, we use modern C++ constructs (C++ 14 and sometimes C++17). Thus, before trying to compile the GeoModel libraries, be sure your compiler supports C++17.
In the GeoModel packages, we use **modern C++** constructs (C++ 14 and sometimes C++17). Thus, before trying to compile the GeoModel libraries, be sure your compiler supports **C++17**.
!!! note
If you use GCC, we successfully tested the build of GeoModel packages on GCC 6.2 and beyond (GCC 7, GCC 8).
If you use GCC, we successfully tested the build of GeoModel packages on GCC 6.2 and beyond (GCC 7, GCC 8, GCC 9).
If you use Clang (mainly on macOS), we successfully tested the GeoModel build on Clang/Xcode 10 and Clang/Xcode 11.
### macOS
### Third-party libraries - macOS
On macOS, you can install all the needed third-party dependencies by using the [Homebrew](https://brew.sh) package manager:
Before building the GeoModel libraries from source, as explained here below, please check if you have old versions of them installed on your system and remove them.
Also, you should remove all GeoModel packages previously installed through `brew`, because they could be picked up by the build system while building the sources, affecting the compilation.
You can check if you have GeoModel libraries which had installed with Homebrew by typing:
!!! warning
```
brew list
```
Before building the GeoModel libraries from source, please check if you have old versions of them installed on your system and remove them.
Also, you should remove all GeoModel packages previously installed through `brew`, because they could be picked up by the build system while building the sources, affecting the compilation.
Please remove **all** the `geomodel`-packages before trying to build the packages from source.
Then, you can remove the old GeoModel packages with, for example:
See the [Troubleshooting](troubleshooting.md) page for additional details and instructions.
```
brew remove geomodelcore
```
Please remove **all** the `geomodel`-packages before trying to build the packages from source.
See also the [Troubleshooting](troubleshooting.md) page for additional help.
### Linux/Ubuntu
On Ubuntu, you can install all the needed third-party dependencies by using the built-in `apt` package manager:
With these instructions you will build the whole the software stack for GeoModel development. The GeoModel libraries will be built from the HEAD version of the 'master' branch. If something does not compile, please [let the developers' team know](../contacts.md).
### Build and Install locally
These instructions will install the libraries and the tools in a local `install` folder. That is useful for developmemnt, because yuo can handle multiple versions installed on the same system.
## Build the visualization dependencies
However, if you prefer to install the tools and the libraries in the `/usrl/local` system directory, just remove from the commands the option `-DCMAKE_INSTALL_PREFIX=../install`.
### 3D graphics dependencies - macOS
#### Build the base libraries and tools (GeoModelCore, GeoModelIO, GeoModelTools)
On macOS, you can install the needed graphics dependencies with `brew`.
This will install the base libraries and tools, the ones conatined in the packages GeoModelCore (GeoModelKernel), GeoModelIO (I/O libraries and the interface to the SQLite engine), and GeoModelTools (XML and JSON parsers, GeoModelXML, the `gmcat` concatenation command line tool):
If you have not installed the `atlas/geomodel` Tap already, please install it now, by running the command below; otherwise, jspi this and jump to the next point.
A note: on some platforms, the default Eigen, Xerces-C, and nlohmann_json libraries installed through the platform's package manager are quite old. If you desire, you can build GeoModel with a builtin version of those libraries by enabling the corresponding options at configuration time:
brew tap atlas/geomodel https://gitlab.cern.ch/GeoModelDev/packaging/homebrew-geomodel.git
If you compile on Centos7, that above could be a convenient option.
#### Build the optional packages
There are several options offered to the user to selectively build the optional packages.
!!! note
You can see all the available options, and you can enable/disable them inetractively, by using the command for the interactive CMake configuration `ccmake`, instead of the classical `cmake`; *i.e.*: `cmake ../GeoModel`.
#### Build the visualization tools (GeoModelVisualization)
Now, update your `atlas/geomodel` Tap to the latest version and install the graphics libraries:
##### 3D graphics dependencies - macOS
On macOS, you can install the needed graphics dependencies with `brew`:
```
brew tap atlas/geomodel https://gitlab.cern.ch/GeoModelDev/packaging/homebrew-geomodel.git # this, only the first time you install the 'atlas' Homebrew repository (Tap)
brew update # this will pick up the latest version of the 'atlas' Homebrew formulas
brew install soqt-geomodel # this will install the latest `simage-geomodel`, `coin-geomodel`, and `soqt-geomodel`
brew update
brew install soqt-geomodel
```
The second command will install all the latest graphics libraries needed by the visualization tools of GeoModel: `simage-geomodel`, `coin-geomodel`, and `soqt-geomodel`.
##### 3D graphics dependencies - Linux
### 3D graphics dependencies - Linux
On Linux, you can build the needed graphics libraries by following the instructions below.
###### a) Simage
#### a) Simage
On all platforms *except Centos7*, you can build Simage by followoing these instructions:
...
...
@@ -157,7 +126,7 @@ cd ..
```
###### b) Coin3D & SoQt
#### b) Coin3D & SoQt
!!! warning
...
...
@@ -173,11 +142,11 @@ cd ..
Now, you should build Coin3D (the 3D graphics engine) and SoQt (the glue package between the 3D graphics engine, Coin, and the windowing system, Qt5):
Now, you can build the GeoModel visualization tools by enabling the corresponding option in the CMake configuration of GeoModel.
## Quick instructions - Build everything
With these instructions you will build the whole the whole software stack for GeoModel development. The GeoModel libraries will be built from the HEAD version of the 'master' branch. If something does not compile, please [let the developers' team know](../contacts.md).
With these instructions, you will build: `GeoModelCore`, `GeoModelIO`, `GeoModelTools`, `GeoModelVisualization` (a.k.a., `gmex`).
!!! note
These instructions will install the libraries and the tools in a **local** `install` folder. That is very useful for developmemnt, because yuo can handle multiple versions installed on the same system.
However, if you prefer to install the tools and the libraries in the `/usrl/local` system directory, just remove from the commands the option `-DCMAKE_INSTALL_PREFIX=../install`.
This will install everything: the base libraries contained in the packages `GeoModelCore` (the kernel libraries and utilities) and `GeoModelIO` (the I/O libraries and the interface to the underlying data formats and/or databases), the tools contained in `GeoModelTools` (XML and JSON parsers, the `GeoModelXML` interface, the `gmcat` concatenation command line tool), and the viusalization tools contained in `GeoModelVisualization` (`gmex`):
To do that, come back to the `build_geomodel` folder we created earlier, or create a new directory for this build right now, then run:
```
cd build_geomodel # or 'cd' to the new directory you have just created for this specific build
On some platforms (for example, on Centos 7 and some Ubuntu releases), the default `Eigen`, `Xerces-C`, and `nlohmann-json` libraries installed through the platform's package manager are quite old. If you desire, you can build GeoModel with a built-in, tested version of those libraries by enabling the corresponding options at configuration time with these additional build options:
If you compile on Centos7, that above could be a very convenient option, which lets you skip the installation of custom versions of those libraries directly on your system.
In these instructions we are building everything, because that is the most used configuration. But the GeoModel build is highly modular, and you can install different combinations of the GeoModel subpackages.
You can see all the available options, and you can enable/disable them inetractively, by using the command for the interactive CMake configuration `ccmake`, instead of the classical `cmake`; *i.e.*: `cmake ../GeoModel`.
*More details on that coming soon....*
### (Optional) Build an example GeoModelPlugin
## (Optional) Build an example GeoModelPlugin
...
...
@@ -246,11 +258,11 @@ cd ..
```
### Post install settings
## Post install settings
Assuming you followed the above instructions and you used `../install` as the installation path.
#### macOS
### macOS
```bash
# After compilation, you should apply two temporary fixes:
...
...
@@ -258,7 +270,7 @@ install_name_tool -add_rpath ../install/lib ../install/bin/gmex # This is a tem
export GXPLUGINPATH=../install/lib/gxplugins # this is a temporary fix
```
#### Linux/Ubuntu
### Linux/Ubuntu
```bash
# After compilation, you should apply this temporary fix:
...
...
@@ -266,7 +278,7 @@ export GXPLUGINPATH=../install/lib/gxplugins # this is a temporary fix
export LD_LIBRARY_PATH=${PWD}/../install/lib/ # this is a temporary fix
```
#### Linux/Fedora
### Linux/Fedora
```bash
# After compilation, you should apply this temporary fix:
...
...
@@ -276,7 +288,7 @@ export LD_LIBRARY_PATH=../install/lib:../install/lib64:$LD_LIBRARY_PATH # this i
Sometimes, cleaning the system from old packages helps in resolving "brew"-related issues.
Sometimes, cleaning the system from old packages helps to solve `brew`-related issues.
Also, please clean your system from old packages before installing new packages, or new versions of the packages.
Also, please clean your system from old packages before installing new packages, or new versions of the packages. This will fix installation issues, in case `brew` does not succeed to correctly upgrade the installed packages.
You can see the list of all `brew` packages installed on your system with: `brew list`.
You can see the list of all `brew` packages installed on your system with:
```
brew list
```
Then, you can clean the system by removing the GeoModel packages.
To do so, just type, for example:
To do so, just type `brew remove` and the name of the packages that need to be removed (you might be asked to use `brew uninstall` for specific cases; in that case, you will get a clear error message from `brew` about that and you should merely follow the on-screen instructions).
If you see packages like `geomodelcore` in the output of `brew list`, that means that you have old versions of the GeoModel packages installed. Please remove them and update to the latest packages; for example, by using (please remove from the commands below the packages that are not present on your system, otherwise `brew` will complain):