We require a number of libraries and frameworks that are not part of OPM itself to be installed before you can build. For instructions see the prerequisites page. Most prerequisites usually have installable packages available (depending on your OS or distro).
Also, while it is possible to have installed binary package versions of OPM modules on your system at the same time that you build/use OPM from source, it is a typical source of hard-to-find errors. We therefore recommend that you uninstall the opm binary packages before you start building from source.
Build the opm modules in the following order:
Not every item depends on everything above it, but all depend on at least one item above it. ResInsight is quite independent, and can be built without any of the other modules. For more information, there is a module overview.
This structure is subject to change: it is likely that new modules will appear, and existing modules will be combined or restructured. We are currently working on reducing the number of modules to simplify the structure.
Note: since the 2019.10 release we have renamed ewoms to opm-models and do not use libecl any more.
First, you should use git to clone the source repositories, like this:
git clone https://github.com/OPM/[modulename].git
Alternatively, you can download the release tarballs. We recommend that you put all the modules in a single directory. Then, to build any module,
mkdir [modulename]/build cd [modulename]/build cmake .. make
Since some modules depend on others, you may save yourself trouble by building the modules in the order given above, starting with opm-common.
Tips and tweaks
To do all of this in one go, you can try this bash script:
#!/bin/bash for repo in opm-common opm-material opm-grid opm-models opm-simulators opm-upscaling do echo "=== Cloning and building module: $repo" git clone https://github.com/OPM/$repo.git mkdir $repo/build cd $repo/build cmake .. make cd ../.. done
To speed up compilation on a multicore machine, you may want to use for example on a 8-core machine:
make -j 7
This will start 7 parallel compilation jobs, leaving one core for other things.
You may need to customize the build process in order to specify compiler options, nonstandard library locations, build type and more. Then replace the cmake command with:
cmake -C options.cmake ..
The options.cmake file contains your customization. CMake syntax must be used, an example of such an options file is given below. It specifies that you want a Debug build (the default is Release) and not use OpenMP.
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type") set(USE_OPENMP OFF CACHE BOOL "Do not use OpenMP")
If you want to build with MPI support, you must turn it on in the call to cmake. Do this by adding the “-DUSE_MPI=1” option to the cmake calls, or if using an options.cmake file add the line
set(USE_MPI ON CACHE BOOL "Use MPI")
to your options.cmake file.
Finally, if you built and installed the prerequisites Dune and/or Zoltan yourself instead of by installing binary packages for them, you may need to specify their installed locations on the cmake command line, do this by adding
to the command, replacing /first/path etc by the locations you installed the libraries to.