Arch Linux – Installing llvm-svn and mesa-git for intel or amd gpus.

Watch this video on YouTube.

Preface:
The reason I decided to write this guide is because mesa-git always, and I mean, ALWAYS has new and exciting things happening almost weekly as far as driver contributions go. If you are on an intel or amd gpu, or both, you REALLY should be running mesa-git if you’re remotely interested in playing the latest and greatest games via natively or via DXVK+wine or Steam Play/Proton. Note: These instructions should also work on Antergos and Manjaro.

libglvnd:
https://github.com/NVIDIA/libglvnd
glvnd is a vendor neutral libgl library that was made by nvidia so that nvidia proprietary drivers can co-exist with mesa on the same system. The use-case for this is usually desktops or laptops with an intel iGPU and an nvidia dGPU. If you are running intel/amd or all amd, you don’t need libglvnd. My reason for removing it was because it causes Dying Light to crash on mesa. Mesa has it’s own version of libgl that it can provide if specified in the config. This is what you want to use.

Instructions:

  • PART 1:

First we’re going to start by using the precompiled packages from unofficial arch user repositories:
https://wiki.archlinux.org/index.php/unofficial_user_repositories

Let’s add the repositories we need:
sudo nano /etc/pacman.conf

add the following:


[llvm-svn]
SigLevel = Never
Server = https://repos.uni-plovdiv.net/archlinux/$repo/$arch

[mesa-git]
SigLevel = Never
Server = https://pkgbuild.com/~lcarlier/$repo/$arch

then:
sudo pacman -Sy clang-svn lib32-clang-svn llvm-libs-svn lib32-llvm-libs-svn llvm-svn lib32-llvm-svn mesa-git lib32-mesa-git mesa-demos

now vulkan required packages:
sudo pacman -S vulkan-icd-loader lib32-vulkan-icd-loader vulkan-tools

now install vulkan drivers for your gpu (you can install both intel and radeon drivers side by side):
sudo pacman -S vulkan-radeon-git lib32-vulkan-radeon-git vulkan-intel-git lib32-vulkan-intel-git

once all that’s done, run:

glxinfo | grep 'OpenGL'
to verify that its using llvm 8.0.0 and mesa 18.3.0

and then:

vulkaninfo | grep "GPU id"
to verify vulkan recognizes your gpu(s)

  • PART 2: Compiling mesa-git and lib32-mesa-git

Now, if you followed part 1 and don’t care to compile your own packages, that’s it, you’re done!. If you DO want to compile your own mesa packages, here’s how.

First, llvm-svn does not need to be updated very often, maybe once a month. PLEASE KEEP IN MIND: If you update llvm, you either need to ALSO update mesa-git, or recompile mesa-git. What I do is I comment out the repos:

sudo nano /etc/pacman.conf


#[llvm-svn]
#SigLevel = Never
#Server = https://repos.uni-plovdiv.net/archlinux/$repo/$arch

#[mesa-git]
#SigLevel = Never
#Server = https://pkgbuild.com/~lcarlier/$repo/$arch

Then, when I want to update llvm, I uncomment the llvm-svn repo, and run sudo pacman -Syu. THEN I recompile mesa-git:
yay -S mesa-git lib32-mesa-git

It’s important to note I’m using yay here, so that it compiles the packages from the AUR. Also to be noted is that this will replace your vulkan packages, as the AUR packages build updated vulkan packages. I would run this about once a week.

DO NOT FORGET: If you update llvm in any way, you must also update or compile mesa-git afterwards.

That’s it for compiling mesa-git!

  • PART 3: Compiling mesa-git without libglvnd

I have two of my own gitlab repositories that makes this easy to do.

First let’s clone them:


git clone http://gitlab.com/gloriouseggroll/mesa-git-noglvnd
git clone http://gitlab.com/gloriouseggroll/lib32-mesa-git-noglvnd

Now lets make both packages:


cd mesa-git-noglvnd
makepkg
cd ../lib32-mesa-git-noglvnd
makepkg

They need to be installed at the same time, which is why we compiled them both first. Now lets move them to the same folder and install them:


cp *.pkg.tar.xz ../mesa-git-noglvnd/
cd ../mesa-git-noglvnd
sudo pacman -U *.pkg.tar.xz

When you do this, it’s going to ask you to replace vulkan-radeon and/or vulkan-intel packages, as well as remove libglvnd. This is because mesa-git provides all of those when compiled from this package, libglvnd being replaced with mesa’s libgl. If compiled from the AUR, it replaces just the vulkan packages.

Lastly, once again run:
glxinfo | grep 'OpenGL'
to verify that its using llvm 8.0.0 and mesa 18.3.0

and then:

vulkaninfo | grep "GPU id"
to verify vulkan recognizes your gpu(s)

That’s all! Hope this helps!