Introduction to Mesa

Mesa is an OpenGL compatible 3D graphics library.

This package is known to build and work properly using an LFS-8.1 platform.

Package Information

Additional Downloads

Mesa Dependencies


Xorg Libraries, libdrm-2.4.82, Mako-1.0.4, and Python-2.7.13



libgcrypt-1.8.0, Nettle-3.3, Wayland-1.14.0 (required for Plasma-5.10.5 and LXQt), mesa-demos (provides more than 300 extra demos to test Mesa; this includes the same programs added by the patch above), and Bellagio OpenMAX Integration Layer (for mobile platforms)



The instructions below assume that elfutils and LLVM with the r600/amdgpu and host backends are installed. You will need to modify the instructions if you choose not to install them. For an explanation of Gallium3D see

User Notes:

Installation of Mesa

If you have downloaded the xdemos patch (needed if testing the Xorg installation per BLFS instructions), apply it by running the following command:

patch -Np1 -i ../mesa-17.1.6-add_xdemos-1.patch

Now, select the drivers you wish to install. The available drivers are i915, nouveau, r300, r600, radeonsi, freedreno, svga, swrast, vc4, and virgl. If the Gallium drivers are not specified, the default is 'r300,r600,svga,swrast'. Modify the command below for any desired drivers. The listed drivers below will cover most modern video cards. For help in selecting drivers see


Install Mesa by running the following commands:



Add wayland to the --with-egl-platforms switch below if you plan on building Plasma-5.10.5 or LXQt.

sed -i "/pthread_stubs_possible=/s/yes/no/" &&

./ CFLAGS='-O2' CXXFLAGS='-O2' \
            --prefix=$XORG_PREFIX        \
            --sysconfdir=/etc            \
            --enable-texture-float       \
            --enable-osmesa              \
            --enable-xa                  \
            --enable-glx-tls             \
            --with-platforms="drm,x11"   \
            --with-gallium-drivers=$GLL_DRV &&

unset GLL_DRV &&


If you have applied the xdemos patch, build the demo programs by running the following command:


To test the results, issue: make check.

Now, as the root user:

make install

If you have built the demo programs, install them by running the following command as the root user:

make -C xdemos DEMOS_PREFIX=$XORG_PREFIX install

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

install -v -dm755 /usr/share/doc/mesa-17.1.6 &&
cp -rfv docs/* /usr/share/doc/mesa-17.1.6

Command Explanations

sed -i ... This sed removes a dependency on the libpthread-stubs package which is useless on Linux.

CFLAGS="-O2" CXXFLAGS="-O2": By default, Autoconf sets CFLAGS and CXXFLAGS to "-g -O2". That results in binaries and libraries being built with debugging symbols which make them bigger. Override the default flags to omit the -g compiler flag so the final libraries are smaller.

--enable-texture-float: This switch enables floating-point textures and render buffers. Please consult docs/patents.txt to see if there are any legal issues if you use this feature.

--enable-osmesa: This switch enables building the libOSMesa library.

--enable-xa: This switch enables building the XA X Acceleration API (Required for VMware 3D Driver).

--enable-gbm: This switch enables building the Mesa Graphics Buffer Manager library.

--enable-glx-tls: This switch enables TLS (Thread Local Storage) support in GLX.

--with-platforms="...": This parameter controls which platforms EGL will be built for. Available platforms are drm, x11 and wayland.

--with-gallium-drivers="...": This parameter controls which Gallium3D drivers should be built.

--enable-sysfs: Use this switch to enable simple PCI identification method, required for building DRI on systems without udev.


Installed Programs: glxgears and glxinfo
Installed Libraries:,,,,,,, (if built with Wayland),, and
Installed Directories: $XORG_PREFIX/{include/{EGL,GL,GLES,GLES2,GLES3,KHR},lib/{dri,vdpau}} and /usr/share/doc/mesa-17.1.6 (optional)

Short Descriptions


is a GL demo useful for troubleshooting graphics problems.


is a diagnostic program that displays information about the graphics hardware and installed GL libraries.

provides a native platform graphics interface as defined by the EGL-1.4 specification.

is the Mesa Graphics Buffer Manager library.

is the Mesa OpenGL ES 1.1 library.

is the Mesa OpenGL ES 2.0 library.

is the main Mesa OpenGL library.

is the Mesa Off-screen Rendering library.

is the Xorg Gallium3D acceleration library.

Last updated on 2017-08-19 20:26:54 -0700