Skip to content

Instantly share code, notes, and snippets.

@nkreeger
Last active December 1, 2018 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nkreeger/02dbc011e587e630dbe3d3f1b94580ff to your computer and use it in GitHub Desktop.
Save nkreeger/02dbc011e587e630dbe3d3f1b94580ff to your computer and use it in GitHub Desktop.

Easy build/configure/comile/usage of Mesa on Ubuntu Bionic (18.04)

Build prereqs:

Enable 'Source Code' from "Software & Updates" app or manually on sources.d.

Next, run the following:

sudo apt-get build-dep mesa
sudo apt install libxrandr-dev meson

Clone & Configure mesa

git clone git://anongit.freedesktop.org/mesa/mesa
cd mesa
meson build \
    --prefix=$HOME/mesa \
    -Ddri-drivers=nouveau \
    -Dgallium-drivers=nouveau \
    -Dvulkan-drivers= \
    -Dplatforms=x11,drm,surfaceless

Build & Install to $HOME/mesa

ninja -C build install

Run local app against mesa build:

First create local script:

Save as script 'local-mesa.sh':

exec env \
    LD_LIBRARY_PATH=$HOME/mesa/lib \
    LIBGL_DRIVERS_PATH=$HOME/mesa/lib/x86_64-linux-gnu/dri \
    GBM_DRIVERS_PATH=$HOME/mesa/lib \
    $@

Next run:

./local-mesa.sh ./my-app

Handy debug variables:

export MESA_DEBUG=1
export LIBGL_DEBUG=verbose
export EGL_LOG_LEVEL=debug

Switching from nvidia to nouveau drivers help:

https://askubuntu.com/questions/1032357/how-to-switch-from-nvidia-to-nouveau-drivers-on-ubuntu-18-04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment