Support us on Patreon to keep GamingOnLinux alive. This ensures all of our main content remains free for everyone. Just good, fresh content! Alternatively, you can donate through PayPal. You can also buy games using our partner links for GOG and Humble Store.
We do often include affiliate links to earn us some pennies. See more here.

Building Mesa from source, a guide

By -
If you are using Mesa (FOSS OpenGL/Vulkan drivers on Linux), you can be in situation when it introduces some new features upstream, but it didn't make it into your distribution yet and it can take quite a long time for that to happen. Certain games can become playable with that change, or it can be a performance optimization that speeds up already working games, or may be you simply want to test the newest Mesa itself - either way, you might be interested in running the latest development version of Mesa for various reasons. At the same time you don't want to mess up your system with an unstable graphics stack.

I started a guide on the GamingOnLinux Wiki, to explain how to build and use Mesa for playing games while keeping your system Mesa intact. It's focused on Debian (testing), but you can use same ideas and adjust it to any distribution if you use a different one. Article taken from GamingOnLinux.com.
Tags: HOWTO
12 Likes
The comments on this article are closed.
15 comments
Page: «2/2
  Go to:

Beren Jan 13, 2017
Quoting: JohnersI personally don't see why Canonical can't push the latest stable Mesa build to their users.

This discussion is moot. If you want a modern distribution with a modern update process you would go with a rolling release distro. "Stable" distros, particulary ones that aim for the server market like Ubuntu, does not make an awful lot of sense for home users, least of all gamers.

Don't get me wrong, Ubuntu is great at what it does. However, if you want the latest and greatest software, Ubuntu is not your distro. Sure, you can bridge the gap somewhat with PPAs, but that's not really a great solution to something rolling releases solves by default.
throgh Jan 13, 2017
Would it be possible having some hints about "Gallium Nine" to be included within the build process? To be honest: For the moment I'm trying this out with an R600 but I don't get the DRI3-support working on my Devuan-System. :(
Shmerl Jan 13, 2017
Quoting: throghWould it be possible having some hints about "Gallium Nine" to be included within the build process? To be honest: For the moment I'm trying this out with an R600 but I don't get the DRI3-support working on my Devuan-System. :(

I didn't use it myself yet, so can't speak from experience. But if you'll figure out how to do it - feel free to add a section about Gallium 9 to the wiki :)
boltronics Jan 14, 2017
Quoting: Shmerl
Quoting: boltronicsI also use `make install` to install, and am not sure why that wasn't suggested on the wiki. You only need to temporarily allow write access to the target directory (/opt/mesa-master/ in the example) which can easily be reverted afterwards - and the instructions even do this anyway with the `chown root:root` command. In my case, everything is scripted.

You can, but I wanted only a minimal set of files. make install would deploy more stuff, and also if you mess up your prefix by mistake, it will clutter or let alone mess up some system directories. So I'd rather avoid using it in the guide. If you script it all, there is less chance of mistakes once it's tested, then it's more reasonable to use it.

In my case, I chown my /opt/<mesa> directory so `make install` simply has no privileges to write anywhere else. :)


Quoting: Shmerl
Quoting: boltronicsI also have LIBGL_DRIVERS_PATH exported from a file in /etc/profile.d/ and I add my custom library paths to a file under /etc/ld.so.conf.d/ and use ldconfig so that's one less environment variable to worry about.

I also avoid setting VK_ICD_FILENAMES by adding ICD JSON files under /etc/vulkan/icd.d, which is within the default search path and doesn't seem touched by any current Debian packages.

I didn't want to make global overrides. The whole point was to only use custom Mesa on demand, when you want it, and let the rest of the system and applications use default Mesa. If you are confident that it works well - you can always add those global overrides in /etc/profile.d/ and /etc/vulkan/icd.d as you mentioned.

Fair enough, that's a good idea when starting out. I actually install to /opt/mesa-<arch>-<release/date+hash> and symlink that to /opt/mesa-arch so I can always go back by just changing a symlink.

Good work in writing it all up!


Last edited by boltronics on 14 January 2017 at 2:11 am UTC
Ivancillo Jan 14, 2017
This remembers me the times when I build Mesa from source to include glide support.

Quake 2 on my Voodoo Banshee ...

And the times I compiled M.A.M.E. (again for glide support).

I'm getting old.

Luckily, turtles live many years.
While you're here, please consider supporting GamingOnLinux on:

Reward Tiers: Patreon. Plain Donations: PayPal.

This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
The comments on this article are closed.
Buy Games
Buy games with our affiliate / partner links: