ObjectiveInstall the latest stable version of Mesa on Debian Stretch.
DistributionsDebian 9 Stretch
RequirementsA working install of Debian Stretch with root access.
- # - requires given linux commands to be executed with root privileges either directly as a root user or by use of
- $ - requires given linux commands to be executed as a regular non-privileged user
IntroductionMesa is a big deal if you're running open source graphics drivers. It can be the difference between a smooth experience and an awful one. Mesa is under active development, and it sees constant noticeable performance improvements. That means it's really worthwhile to stay on top of the latest releases. Debian usually doesn't, though, so Debian users have to take matters into their own hands. If you're running Debian Stretch and want the latest stable version of Mesa, building it yourself is your only option. Don't worry, it's actually not that bad.
BLUE SKY STUDIOS are looking for Linux Administrator to maintain and support the Studio's 450+ production Linux workstations, including daily interactions with the Studio’s digital animation artists.
LOCATION: Greenwich, Connecticut, USA
Install The DependenciesBefore you can build Mesa, there are dependencies that you need to install. Mesa is a large and complex program, so there are more than a few, but they're all available through
apt. Start off by grabbing
aptpull Mesa's hard build dependencies.
# apt install build-essential # apt build-dep mesa libdrm2Once you have those, you need LLVM and Clang. Install version
3.9and the dependencies related to them.
# apt install llvm-3.9 llvm-3.9-dev clang-3.9 clang-3.9-dev libxvmc-dev libxcb-xvmc0-dev libvdpau-dev libomxil-bellagio-devLLVM-3.9 isn't the default version in Stretch even though the other available versions are ridiculously out-of-date. To avoid any weirdness, create a symlink between LLVM-3.9's config and the default LLVM config.
# ln -s /usr/bin/llvm-config-3.9 /usr/bin/llvm-config
Install Libdrm from SidBecause Debian is so awesomely out-of-date, you can't build Mesa without first installing the Libdrm packages available from Sid. Don't worry. This uses apt-pinning to ensure that only the Libdrm packages are installed from Sid, so your system won't become unstable. Start off by adding the following lines to
deb http://ftp.us.debian.org/debian/ sid main deb-src http://ftp.us.debian.org/debian sid mainNext, you need to create a new file at
/etc/apt/preferences. Make it look like the example below.
Package: * Pin: release a=stable Pin-Priority: 1000 Package: * Pin: release a=unstable Pin-Priority: 2 Package: libdrm2 Pin: release a=unstable Pin-Priority: 1001 Package: libdrm-* Pin: release a=unstable Pin-Priority: 1001Update
aptand install the updated packages.
# apt update # apt install libdrm2 libdrm-dev
Clone Mesa From GitNow, you can clone the Mesa source code from Git. Head into the directory where you want to build it and clone.
$ cd ~/Downloads $ git clone -b 17.1 git://anongit.freedesktop.org/mesa/mesaRight now, Mesa 17.1 is the latest stable version. If that changes, clone that branch. If you want to run the absolute latest code, leave out
-bflag, but that may be unstable. After it finishes cloning,
$ cd mesa
Build And Install MesaYou can configure and compile Mesa now. The
autogenexample below is designed to be as robust as possible and to work in nearly all situations. If you want to tailor it to your system, look up all of the options available, or cut back the things you know you don't need.
./autogen.sh --prefix=/usr --enable-texture-float --libdir=/usr/lib/x86_64-linux-gnu/ --with-gallium-drivers=i915,r300,r600,radeonsi,nouveau,swrast --with-egl-platforms=drm,x11 --enable-glx-tls --enable-shared-glapi --enable-glx --enable-driglx-direct --enable-gles1 --enable-gles2 --enable-gbm --enable-openmax --enable-xa --enable-osmesa --with-radeonsi-llvm-compiler --enable-sysfs --enable-vdpau --enable-xvmc --enable-openmax --enable-nineOnce the configuration finishes, you can build and install Mesa. Use the
-jflag followed by the number of cores on the computer plus 1 to speed up compiling.
$ make -j5 # make installThe compile will take some time. When it's done and installed, restart the X server or your computer. When you reboot, you will be running your new version of Mesa.