Mesa-25.3.5

#### Gaming Linux® From Scratch - Version 13.0

### Chapter 13. Graphics Drivers - Mesa

- Prev

  Graphics Drivers - Mesa

- Next

  X11

- Up
- Home

# Mesa-25.3.5

## Introduction to Mesa

Mesa contains several libraries and drivers for multiple APIs like OpenGL and Vulkan.

### Important

This package can install its own OpenGL libraries, but is not supported by this book's editors due to their various issues. Read About OpenGL for more information. If you do not want to install libglvnd-1.7.0 and want to install this package's OpenGL libraries, the Command Explanations will instruct you to remove a given parameter in order to do so.

### Note

Mesa is updated relatively often. You may want to use the latest available version.

### Note

An Internet connection is needed for building the Nouveau Vulkan driver. The system certificate store may need to be set up with make-ca-1.16.1 before building this package.

### Note

This may take a while to build. Feel free to do something else while this is building.

### Important

For the lib32 installation instructions, they require new Meson cross files from MLFS, as `--libdir=/usr/lib32` has been moved to the cross files and no longer appear in the instructions. Install the new cross files so that 32-bit libraries don't get installed in `/usr/lib`.

- Download: https://mesa.freedesktop.org/archive/mesa-25.3.5.tar.xz

### Mesa Dependencies

Required
libdrm-2.4.131, libxcb-1.17.0, mako-1.3.10, PyYAML-6.0.3, and Xorg Libraries
Recommended

- Cbindgen-0.29.2, make-ca-1.16.1, rust-bindgen-0.72.1, and Rustc-1.93.1 (required for Nouveau Vulkan)

- libclc-21.1.8 (required for the Intel Iris Gallium3D and Nouveau Vulkan)

- libgbm-1.0.4 (to replace Mesa's `libgbm`[6])

- libglvnd-1.7.0 (for the main OpenGL libraries)

- libva-2.23.0 (to provide VA-API support for some Gallium3D drivers, note that there is a circular dependency. You must build libva first without EGL and GLX support, install this package, and rebuild libva)

- LLVM-21.1.8 (required for the r300, r600, and radeonsi drivers, and the LLVMpipe software rasterizer; Clang in LLVM is required for Swrast Vulkan)

- Vulkan-SDK-1.4.341.0 (required for Vulkan and Zink Gallium3D support)

- Wayland-Protocols-1.47 (required for many desktop environments and recommended for GTK)

Optional
libdisplay-info, libunwind-1.8.3, lm-sensors, Mesa-Demos (provides more than 300 demos to test Mesa), OpenCL-Headers-2025.07.22, valgrind, Bellagio OpenMAX Integration Layer (for mobile platforms), and libtizonia

## Installation of Mesa

Install Mesa by running the following commands:

    mkdir build &&
    cd    build &&

    meson setup --prefix=/usr            \
                --buildtype=release      \
                -D glvnd=enabled         \
                -D libgbm-external=true  \
                -D platforms=x11,wayland \
                -D gallium-drivers=auto  \
                -D vulkan-drivers=auto   \
                -D video-codecs=all      \
                -D valgrind=disabled     \
                -D libunwind=disabled    \
                .. &&

    ninja

Now, as the `root` user:

    ninja install

If desired, install the optional documentation by running the following commands as the `root` user:

    cp -rv ../docs -T /usr/share/doc/mesa-25.3.5

## lib32 Installation of Mesa

Install lib32-Mesa by running the following commands:

    rm -rf * &&
    meson setup --prefix=/usr            \
                --buildtype=release      \
                --cross-file=lib32       \
                -D glvnd=enabled         \
                -D libgbm-external=true  \
                -D platforms=x11,wayland \
                -D gallium-drivers=auto  \
                -D vulkan-drivers=auto   \
                -D video-codecs=all      \
                -D valgrind=disabled     \
                -D libunwind=disabled    \
                .. &&
    sed -i 's/\/usr\/lib\//\/usr\/lib32\//g' ./build.ninja &&

    BINDGEN_EXTRA_CLANG_ARGS="-m32" ninja

Now, as the `root` user:

    DESTDIR=$PWD/DESTDIR ninja install                     &&
    cp -vr DESTDIR/usr/lib32/* /usr/lib32                  &&
    if [ -d DESTDIR/usr/share/vulkan ]; then
        cp -vR DESTDIR/usr/share/vulkan /usr/share
    fi                                                     &&
    rm -rf DESTDIR                                         &&
    ldconfig

## Command Explanations

### Note

Inspect `meson_options.txt` or `meson.options` for a full list of options.

`--buildtype=release`: This switch ensures a fully-optimized build, and disables debug assertions which will severely slow down the libraries in certain use-cases. Without this switch, build sizes can span into the 2GB range.

`-D glvnd=enabled`: This forces the build system to fail the configuration step if libglvnd-1.7.0 was not found. If you want to accept the risks of using this package's core OpenGL libraries and have not installed libglvnd, remove this parameter. Read About OpenGL for more information. Switching is not recommended.

`-D libgbm-external=true`: This links against the system-installed `libgbm` and disables building the GBM. If you want to install Mesa's `libgbm`, remove this option.

`-D platforms=...`: This parameter controls which windowing systems will be supported. Available linux platforms are x11 and wayland.

`-D gallium-drivers=auto`: This parameter controls which Gallium3D drivers should be built. Gallium drivers are essentially OpenGL drivers. If you wish to build specific drivers, valid options include:

- `auto` selects all Gallium3D drivers available for x86

- `r300` (for ATI Radeon 9000 or Radeon X series)

- `r600` (for AMD/ATI Radeon HD 2000-6000 series)

- `radeonsi` (for AMD Radeon HD 7000 or newer AMD GPU models)

- `nouveau` (for Supported NVIDIA GPUs, they are listed as all “3D features” either “DONE” or “N/A” in the Nouveau status page)

- `virgl` (for QEMU virtual GPU with virglrender support)

- `svga` (for VMWare virtual GPU)

- `softpipe` (using CPU for 3D rasterization)

- `llvmpipe` (`softpipe` but uses LLVM to increase performance)

- `zink` (a driver converting OpenGL calls to Vulkan; if the Vulkan driver is performant, this driver can also be performant; can be used as a replacement for Gallium3D drivers like `nouveau` as detailed in What Now?)

- `iris` (for Intel GPUs shipped with Broadwell or newer CPUs)

- `crocus` (for Intel GMA 3000, X3000 series, 4000 series, or X4000 series GPUs shipped with chipsets, or Intel HD GPUs shipped with pre-Broadwell CPUs)

- `i915` (for Intel GMA 900, 950, 3100, or 3150 GPUs shipped with chipsets or Atom D/N 4xx/5xx CPUs)

You may replace `auto` with a comma-separated list to build only a subset of these drivers if you precisely know which drivers you need, for example: `-D gallium-drivers=radeonsi,iris,swrast`.

`-D vulkan-drivers=auto`: This switch enables support for the Vulkan graphics API. It automatically builds all graphics drivers that are available for Vulkan. If you wish to build specific drivers, valid options include:

- `amd` (for AMD Radeon HD 7730 or newer AMD GPUs)

- `intel` (for Intel GPUs shipped with Skylake or newer CPUs, or as a dedicated PCIe card)

- `intel_hasvk` (for Intel GPUs shipped with Ivy Bridge, Haswell, or Broadwell CPUs)

- `nouveau` (for GTX 16XX, RTX 20XX, or newer NVIDIA GPUs; this driver is maturing and is already quite performant, although less so than the NVIDIA driver; however, it is a good replacement, especially when used with `zink`)

- `swrast` (using CPU for 3D rasterization. Note that it's much slower than using a modern 3D-capable GPU)

You may replace `auto` with a comma-separated list to build only a subset of these drivers if you precisely know which drivers you need, for example: `-D vulkan-drivers=amd,nouveau,swrast`.

`-D video-codecs=all`: This parameter enables building all the video codecs as they are disabled by default to avoid legal issues. It would be prudent to not distribute your build if you set this option. The matter is still unclear, however. See this Debian bug report for more info.

`-D valgrind=disabled`: This parameter disables the usage of Valgrind during the build process. Remove this parameter if you have Valgrind installed, and wish to check for memory leaks.

`-D libunwind=disabled`: This parameter disables the usage of libunwind.

`-D gallium-rusticl=true`: This option enables OpenCL for the Gallium drivers. Additionally, it requires that you specify which drivers get that support. The option for that is `-D gallium-rusticl-enable-drivers`, which you can set to `auto` for convenience. Understand that Rusticl still has a lot of issues.

`-D egl-native-platform="..."`: This parameter controls which Embedded Graphics Library support will be built. Available linux options are auto (default), x11, wayland, surfaceless, and drm.

`-D gles1=disabled`: If you didn't pass `-D glvnd=enabled` and don't need GLESv1, use this option. Some games still use GLESv1.

`-D gles2=disabled`: If you didn't pass `-D glvnd=enabled` and don't need OpenGL ES, use this option.

`BINDGEN_EXTRA_CLANG_ARGS="-m32"`: This variable ensures that rust-bindgen-0.72.1 generates bindings that don't go out of bounds when compiling lib32 Nouveau Vulkan.

sed -i 's/\/usr\/lib\//\/usr\/lib32\//g' ./build.ninja: This package can be stubborn and likes to link against LLVM libraries in `/lib`, even on a multilib installation, so this command tells this package to link against libraries in the proper directory.

## Contents

Installed Programs: None
Installed Libraries: libEGL_mesa, libGLX_mesa, and libgallium-25.3.5
Installed DRI Driver Stubs: libdril_dri and several symlinks to it
Installed VA-API Drivers: nouveau_drv_video, r600_drv_video, radeonsi_drv_video, and virtio_gpu_drv_video (symlinks to libgallium-25.3.5)
Installed GBM Backends: dri_gbm
Installed Vulkan Drivers: libvulkan_intel_hasvk, libvulkan_intel, libvulkan_lvp, libvulkan_nouveau, and libvulkan_radeon
Installed Directories: /usr/lib/{dri,gbm}, /usr/share/drirc.d (contains workarounds for various applications, particularly browsers and games), /usr/share/vulkan, and /usr/share/doc/mesa-25.3.5

### Short Descriptions

`libEGL_mesa` | provides all the EGL functionality for Mesa's EGL drivers to work
`libGLX_mesa` | provides all the GLX functionality for Mesa's GLX drivers to work
`dri_gbm` | is the GBM backend for Mesa drivers
`libdril_dri` | is a stub allowing Xorg server to co-operate with the Gallium3D drivers
`libgallium-25.3.5` | contains all the Gallium3D drivers

[6] By default, libgbm-1.0.4 gets installed as it has a faster installation and requires less dependencies. If you want Mesa's solution, read “Command Explanations” to find out which option to remove.

- Prev

  Graphics Drivers - Mesa

- Next

  X11

- Up
- Home