You can sign up to get a daily email of our articles, see the Mailing List page!
  Go to:
Building Mesa from source and using Mesa master
skyrrd commented on 13 April 2019 at 7:33 pm UTC

Any news about building mesa-git on Debian? Is a chroot or vm still needed? I'm currently eyeing the switch to debian buster, but having to use older versions of mesa is holding me back. I know of ppas but I would prefer to build mesa myself

Shmerl commented on 14 April 2019 at 3:04 am UTC

skyrrdAny news about building mesa-git on Debian? Is a chroot or vm still needed? I'm currently eyeing the switch to debian buster, but having to use older versions of mesa is holding me back. I know of ppas but I would prefer to build mesa myself

The only reason I'm using VM is a separation from the main system, i.e. just for neatness. However I don't build 32-bit Mesa. That would likely require a VM / chroot, due to complications in setting up cross compilation. I got tired trying to make it work. Someone suggested, that if you build it with clang instead of gcc, cross compilation might work. I haven't tried it yet.

If you want newer Mesa than one in buster, you can also install Mesa packages from experimental. It has 19.0.2. See:
That's what I use for 32-bit anyway, due to mess of cross compiling it.

Shmerl commented on 14 April 2019 at 3:19 am UTC

You can find my build script here if it's useful:

Note, you need to have llvm repo configured, for using latest llvm snapshot.

Shmerl commented on 11 July 2019 at 4:07 am UTC

Debian is still stuck with outdated libdrm (freeze is over, but maintainers didn't get back yet I suppose).

So I decided to figure out how to update libdrm from upstream. It's not that hard apparently.

Debian still has libdrm 2.4.97 while Mesa master now requires 2.4.99. So here is what you can do:

wget -O $HOME/downloads/libdrm-2.4.99.tar.gz

mkdir -p $HOME/build/libdrm
cd $HOME/build/libdrm

sudo apt-get build-dep libdrm
apt-get source libdrm

cd libdrm-2.4.97
uupdate $HOME/downloads/libdrm-2.4.99.tar.gz

cd ../libdrm-2.4.99
dpkg-buildpackage -us -uc -nc

You'll need to add some missing symbol definitions along the way to match new upstream. The build failures shows files that differ, so just add everything new to the outdated files.

To build 32-bit variant (you'll need that if you are using 32-bit Mesa), use:

apt-get build-dep -a i386 libdrm
dpkg-buildpackage -a i386 -us -uc -nc

That might require installing some cross gcc packages manually, since apparently build-dep -a i386 is not enough.

Also, when installing the result, I had to use dpkg --force-overwrite -i to work around changelog
conflicts in packages. There is probably some easy way to avoid it, but I didn't drill in enough to find it.

Shmerl commented on 15 August 2019 at 11:44 pm UTC

Just managed to build Mesa master (19.2.0 basically), as regular Debian packages using relatively easy method. It can help for those who are using Navi cards during the gap until Mesa 19.2.0 is actually released. In such case you need system Mesa packages that support Navi to get a functional desktop, and Debian doesn't provide any yet.

The method works similar to the above example with libdrm, except applied to Mesa. Use the source from:

uupdate and dpkg-buildpackage do all the heavy lifting. A few tweaks are needed to debian/control, debian/rules and debian/libegl1-mesa-dev.install like to use libllvm-9-dev (instead of 8) and some other cases needed for newer Mesa, and in the end it works great!

I didn't bother building 32-bit one, since it's a lot more difficult than with libdrm on 64-bit system without having a whole 32-bit environment (VM, lxc, etc.) set up.

Shmerl commented on 10 September 2019 at 12:44 am UTC

Building Mesa master in Debian is totally messed up now. Doesn't work with gcc-8, gcc-9, clang-9 and clang-10.

Shmerl commented on 12 September 2019 at 8:50 pm UTC

I figured out the failure. Missing coroutines llvm module. See:

Temporary fix until it's fixed upstream:

diff --git a/ b/
index 29d7981d13d..ce230f33875 100644
--- a/
+++ b/
@@ -1255,7 +1255,7 @@ if with_gallium_opencl
     'lto', 'option', 'objcarcopts', 'profiledata',
-if with_gallium_opencl or with_gallium_softpipe
+if with_gallium_opencl or with_gallium_softpipe or with_gallium_radeonsi or with_gallium_r600
   llvm_optional_modules += ['coroutines']

Shmerl commented on 18 September 2019 at 1:50 pm UTC

It works for me with the patch. Do you have a more detailed error message?

Shmerl commented on 18 September 2019 at 3:10 pm UTC

Ah, I know what's happening in your case I think. The script resets the source, essentially wiping out the patch. I added a couple of variables to control that. Run the script once, it will update the source but will fail (you can interrupt the building part in that run, the main step is to update the source at this point).

Then apply the patch, and run it adding these couple of flags to the ones you are usually setting:

update_sources=false reset_sources=false .... ./

I'll later update the script to handle manual patches better.

Shmerl commented on 19 September 2019 at 2:25 am UTC

Still hangs with Navi though. I tested aco-navi branch with TW3 - hangs right on startup.

  Go to:

You need to Register and Login to comment, submit articles and more.

Or login with...

Livestreams & Videos
Community Livestreams
  • Silent Hill 4, BLIND, PCSX2
Popular this week
View by Category
Latest Comments
Latest Forum Posts