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:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard

2 Replies to “Cross-Compiling Mesa 3D Graphics Library for ARM”

  1. Hello,
    when i excute this tutorial, i am in the 6 steps Configure and build Mesa for x86.


    i get this eroors undefined reference to nouveau_pushbuf_flush' undefined reference to
    nouveau_bo_pending’ undefined reference to nouveau_pushbuf_marker_undo' undefined reference to
    nouveau_grobj_autobind’ undefined reference to nouveau_pushbuf_marker_emit' undefined reference to
    nouveau_bo_unmap’ undefined reference to nouveau_channel_free' undefined reference to
    nouveau_grobj_free’ undefined reference to nouveau_device_open_existing' undefined reference to
    nouveau_pushbuf_emit_reloc’ undefined reference to nouveau_device_close' undefined reference to
    nouveau_channel_alloc’ undefined reference to nouveau_bo_handle_get' undefined reference to
    nouveau_bo_map’ undefined reference to nouveau_bo_new' undefined reference to
    nouveau_bo_ref’ undefined reference to nouveau_bo_handle_ref' undefined reference to
    nouveau_notifier_alloc’ undefined reference to nouveau_bo_new_tile' undefined reference to
    nouveau_grobj_alloc’ undefined reference to `nouveau_notifier_free’
    collect2: ld returned 1 exit status
    make[6]: *** [] Error 1

    Please Help ME and thank you 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Khadas VIM4 SBC
Khadas VIM4 SBC