Cross-Compiling Mesa 3D Graphics Library for ARM

Mesa is an open-source implementation of the OpenGL specification that can be used for software emulation or  complete hardware acceleration for modern GPUs.The Mesa library is used by a variety of games (e.g. Quake 2.3), libraries (e.g PyOpenGL), science and technical applications and utilities (e.g. xscreensaver).

MesaLib requires X11 libraries. I’ll assume those are already cross-compiled here. For this build, I used pre-built X11 libraries found in ALIP (ARM Internet Platform) binaries. I used the method described here and copied the libs in /lib and /usr/lib and header files in /lib/include found in the qemu overo image respectively to /home/jaufranc/edeve/beagleboard/libs/lib and /home/jaufranc/edeve/beagleboard/libs/include. make sure you use the “-d” with cp to avoid copying the symlinks or some symbolic links would point to x86 binaries or files that do not exist.

Here are the instructions to cross-compile MesaLib 7.11 for ARM using arm-linux-guneabi-gcc:

  1. Download the latest version of Mesa source code:
  2. Extract the source code
  3. Install the following packages (makedepend is part of xutils-dev):
  4. Download, build and install libdrm 2.4.26:
  5. There seems to be a problem with libdrm make install, so we also need to copy some extra header files manually:
  6. Configure and build Mesa for x86.

    You do not actually need to build the full MesaLib at this point, you could interrupt the build after builtin_compiler is built.
  7. Save a copy of builtin_compiler and glsl_compiler:
  8. Clean the source directory:
  9. Start build Mesa for ARM:

    This should end with an error while building builtin_compiler.
  10. Then copy builtin_compiler_x86 back to builtin_compiler
  11. Edit the config file configs/current to add the library paths for GL as follows:
  12. And keep building:

This was tested in Ubuntu 11.04 (natty) and 10.04 LTS with linaro gcc toolchain.

N.B: If your platform does not use X11 and just want to do off-screen rendering, you can build Mesa on linux with:


Share this:

Support CNX Software! Donate via cryptocurrencies or become a Patron on Patreon

ROCK Pi 4C Plus
Notify of
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
Weller PCB manufacturer