Running mesa from git on Ubuntu

| tagged with
  • mesa
  • ubuntu

This was written against Ubuntu 12.04 although it’s unlikely things will change appreciably. You should know what you are doing (and have a good reason to need mesa from git) if you are going to follow these instructions. Following these instructions without proper knowledge could bring harm to you, your pets, or toaster.

First we’ll need some prerequisite packages,

$ sudo apt-get install libpciaccess-dev

Let’s setup a directory to work within,

$ MESA_ROOT=/opt/mesa
$ mkdir $MESA_ROOT
$ cat <<EOF >
export PKG_CONFIG_PATH=\$MESA_ROOT/prefix/lib/pkgconfig:\$PKG_CONFIG_PATH
$ source

First we need to check out libdrm,

$ git clone git://
$ cd drm
$ ./ --prefix=$MESA_ROOT/prefix
$ make
$ make install

Now for mesa. Since I’m working on Intel hardware, I’ll exclude the nouveau and radeon drivers from the build,

$ git clone git://
$ cd mesa
$ ./ --prefix=$MESA_ROOT/prefix --with-dri-drivers=swrast,i915,i965
$ make
$ make install

Now we need to point the system towards our newly built drivers,

$ sudo sh -c "echo LD_LIBRARY_PATH=$MESA_ROOT/prefix/lib:\$LD_LIBRARY_PATH >> /etc/environment"
$ sudo sh -c "echo DRI_DRIVER_PATH=$MESA_ROOT/prefix/lib/dri >> /etc/environment"

In principle restarting your X session should now give you a shiny new mesa.