Close

5th July 2024

OpenFOAM Repo: 1. Software for Compilation

The following supporting software is required to download and compile OpenFOAM from one of the source repositories.  For Ubuntu, the installation of required software packages is described towards the bottom of the page.  Other Linux distributions require equivalent packages which are named accordingly within the respective distributions.

Repository and compilation software

  • Git distributed version control software used for the OpenFOAM source repositories.
  • Compiler: either GCC version 5.5 or above; or LLVM Clang version 16 or above (possibly earlier); or the Intel oneAPI DPC++/C++ Compiler version 2021.3.0 or above. GCC is most commonly available and the version can be checked by typing
    gcc --version
  • FLEX fast lexical analyser, used by OpenFOAM for reading files of third-party format
  • cmake build software for compiling ParaView, the third-party visualisation toolkit.

Software for OpenFOAM (and ParaView)

  • OpenMPI message passing interface for parallel computation.
  • ParaView can be installed as a system package, in which case its dependencies do not need to be installed. However, in order to compile its reader modules within OpenFOAM, all its dependencies need to be installed including the development environments of QT, graphics (GL), data formats, etc

Installing packages on Ubuntu (versions 20.04, 22.04, 24.04)

The specific packages to be installed on Ubuntu are listed below.  The following command installs the packages for repositories and compilation.

sudo apt-get install build-essential cmake git ca-certificates flex

We provide two “meta-packages” which install all the packages required by OpenFOAM and ParaView, named openfoam-nopv-deps and openfoam-deps respectively.  The packages are available at the dl.openfoam.org repository with the public key (gpg.key) verify package signatures.  If the repository is not yet added to the apt system, the user should paste the following into a terminal.

sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key > /etc/apt/trusted.gpg.d/openfoam.asc"
sudo add-apt-repository http://dl.openfoam.org/ubuntu

The second command should automatically update apt, so the dependency packages can then be installed.  Usually, the full set of dependencies are required, as well as a ParaView development package (in order to compile anything relating to ParaView). These can all be installed with the following command.

sudo apt install openfoam-deps paraview-dev

For reference, the “meta-packages” contain the following packages:

openfoam-nopv-deps: 
    build-essential libopenmpi-dev zlib1g-dev gnuplot gnuplot-x11 
    libxt-dev cmake flex

openfoam-deps: 
    libxml2-dev libhdf5-dev libavfilter-dev libtheora-dev libgl2ps-dev 
    libx11-dev libqt5x11extras5-dev libglew-dev libutfcpp-dev 
    libdouble-conversion-dev libfreetype-dev libqt5svg5-dev 
    qtxmlpatterns5-dev-tools qttools5-dev python3-dev
    libpdal-dev # Ubuntu 22.04 and 20.04 only
    libadios2-serial-c-dev libadios2-serial-c++11-dev # Ubuntu 24.04 only

Up: Main Page ↑ | Next: 2. Downloading the OpenFOAM Source Code