You can sign up to get a daily email of our articles, see the Mailing List page!
Support us on Patreon to keep GamingOnLinux alive. This ensures we have no timed articles and no paywalls. Just good, fresh content! Alternatively, you can support us on Paypal and Liberapay!

Building Mesa from source, a guide

Posted by , / 9523 views
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.
13 Likes, Who?
Comments
Page: 1/2»
  Go to:

Johners 13 January 2017 at 10:14 am UTC
I personally don't see why Canonical can't push the latest stable Mesa build to their users. It only makes the experience better as there have been massive improvements to Mesa over the past few years.

As for other distributions, it would be nice if they did the same as well but seeing as Ubuntu is the go to the choice for a lot of developers and end users it makes sense for them to do it at least.


Last edited by Johners at 13 January 2017 at 10:14 am UTC
tuubi 13 January 2017 at 11:04 am UTC
View PC info
  • Supporter
@Johners: Ubuntu can't be bleeding edge as long as Canonical wants OEM's to consider it for preloaded systems. Software developers want a somewhat stable target as well. That's why a lot of commercial software only supports Ubuntu (LTS) releases and why basically none of it officially supports rolling release distributions. Also, gaming is still not such an important concern for Linux distros that it would significantly influence their direction.

The PPA system is a working compromise for many Ubuntu users. You don't need to restrict yourself to the official repositories.
M@GOid 13 January 2017 at 12:38 pm UTC
Tank you for this. I will try it latter. But for AMD users, LLVM is also a important component when running bleeding edge Mesa, especially if you are looking for fixes of bugs. Can you please do a Wiki for how to build it too?
hardpenguin 13 January 2017 at 2:43 pm UTC
This is amazing! Great job!
boltronics 13 January 2017 at 2:52 pm UTC
That's more or less the approach I use. The main difference is that I use a chroot which I enter using schroot, and expose /opt from inside it for deployment directly within the chroot. Once installed, I check all 32-bit deps are met using ldd, just to be safe. eg. `find /opt/mesa-master -type f -exec ldd {} \; | grep 'not found' | sort | uniq`

I 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. I 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.
BlackBloodRum 13 January 2017 at 3:23 pm UTC
Nice job Liam!

This should be a great help for noobs who haven't gotten to compiling yet :-)
liamdawe 13 January 2017 at 3:27 pm UTC
BlackBloodRumNice job Liam Shmerl!

This should be a great help for noobs who haven't gotten to compiling yet :-)
Fixed it for you

Edit: I am currently face-planting into PHP code fixing up some new admin features for GOL, so content from me will come later tonight.


Last edited by liamdawe at 13 January 2017 at 3:28 pm UTC
Shmerl 13 January 2017 at 3:43 pm UTC
M@GOidBut for AMD users, LLVM is also a important component when running bleeding edge Mesa, especially if you are looking for fixes of bugs. Can you please do a Wiki for how to build it too?

Yeah, in theory, you might want to chase the latest developments in the kernel drivers (amdgpu for instance), libdrm and llvm. But that's a whole different level of complexity. This guide assumes that you only update Mesa itself, and all the dependencies are same as the rest of the system. I didn't try building libdrm and llvm myself yet. If I'll get to it, I'll document it on the wiki


Last edited by Shmerl at 13 January 2017 at 3:57 pm UTC
Shmerl 13 January 2017 at 3:51 pm UTC
boltronicsThat's more or less the approach I use. The main difference is that I use a chroot which I enter using schroot, and expose /opt from inside it for deployment directly within the chroot.

Yes, chroot or even a full blown VM is probably a cleaner approach - I mention it in the guide. It's not hard to figure out how to do it, once you know the main process.

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.

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.


Last edited by Shmerl at 13 January 2017 at 3:56 pm UTC
mirv 13 January 2017 at 6:33 pm UTC
View PC info
  • Supporter
I don't recommend trying to compile llvm yourself from bleeding edge git. If llvm 3.9 is available, just stick with that (if it's a version less, you won't have full GL4.5 support).
  Go to:
While you're here, please consider supporting GamingOnLinux on Patreon or Liberapay. We have no adverts, no paywalls, no timed exclusive articles. Just good, fresh content. Without your continued support, we simply could not continue!

We also accept Paypal donations and subscriptions! If you already are, thank you!

Due to spam you need to Register and Login to comment.


Or login with...

Livestreams & Videos
Official Livestreams
Community Livestreams
  • RPGoodness: "Dragon Age Origins" (via Wine)
  • Date:
See more!
Popular this week
View by Category
Contact
Latest Forum Posts
Facebook