Installation/On-Screen Mesa/Ubuntu

From OpenFOAMWiki

1 Introduction

This page gathers information on how to build On-Screen Mesa on Ubuntu. Please keep in mind that:

  1. These instructions might go out of date, in case a particular Ubuntu version upgrades their default Mesa source code version that is provided via apt.
  2. These instructions are designed to integrate directly in OpenFOAM's custom builds of ParaView.

2 Ubuntu 18.04

Note: It's advisable to run these commands only after compiling ParaView and OpenFOAM.


  1. Switch to root mode (administrator), to install the necessary packages:
    sudo -s
    • If the 'sudo' command tells you're not in the sudoers list, then run:
      su -
  2. Update the apt-get cache by running:
    apt-get update
  3. Install the necessary packages:
    apt-get install mesa-utils libglu1-mesa-dev scons llvm-dev python-pip libyaml-dev
    pip install prettytable Mako pyaml dateutils --upgrade

    In addition, we need to turn on the sources list, because we need to install the additional dependencies needed for building Mesa from source code:

    sed -i~orig -e 's/# deb-src/deb-src/' /etc/apt/sources.list   
    apt-get update
    apt-get build-dep mesa

    And you're using a virtual machine, make sure you also install the toolkit provided by your virtualization software. For example, for VirtualBox you can use the following command to install the guest toolkit:

    apt-get install virtualbox-guest-x11
  4. Now exit from the root mode:
  5. Now for the process of building Mesa for the OpenGL software renderer, we need to run the following commands:
    apt-get source mesa
    cd mesa-19.0.2
    scons build=release texture_float=yes libgl-xlib > log.makeMesa 2>&1 &&  cp -vr build/linux-x86_64/gallium/targets/libgl-xlib/* $ParaView_DIR/lib/

    Hopefully everything works as intended and ends with something like the following output:

    'build/linux-x86_64/gallium/targets/libgl-xlib/' -> '/home/ofuser/OpenFOAM/ThirdParty-7/platforms/linux64Gcc/ParaView-5.6.0/lib/'
    'build/linux-x86_64/gallium/targets/libgl-xlib/' -> '/home/ofuser/OpenFOAM/ThirdParty-7/platforms/linux64Gcc/ParaView-5.6.0/lib/'
    'build/linux-x86_64/gallium/targets/libgl-xlib/' -> '/home/ofuser/OpenFOAM/ThirdParty-7/platforms/linux64Gcc/ParaView-5.6.0/lib/'
    'build/linux-x86_64/gallium/targets/libgl-xlib/xlib.os' -> '/home/ofuser/OpenFOAM/ThirdParty-7/platforms/linux64Gcc/ParaView-5.6.0/lib/xlib.os'

    But if not, check the contents of the file log.makeMesa, specifically the end of the file.

  6. And ParaView should now be ready to be used, even though it will sometimes feel a bit sluggish...