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:
- Download the latest version of Mesa source code:
1wget ftp://ftp.freedesktop.org/pub/mesa/7.11/MesaLib-7.11.tar.bz2 - Extract the source code
12tar xjvf MesaLib-7.11.tar.bz2cd Mesa-7.11 - Install the following packages (makedepend is part of xutils-dev):
1sudo apt-get install xutils-dev flex bison xorg-dev llvm - Download, build and install libdrm 2.4.26:
123456wget http://dri.freedesktop.org/libdrm/libdrm-2.4.26.tar.bz2tar xvjf libdrm-2.4.26.tar.bz2cd libdrm-2.4.26./configuremakesudo make install - There seems to be a problem with libdrm make install, so we also need to copy some extra header files manually:
1sudo cp nouveau/*.h /usr/include/drm/ - Configure and build Mesa for x86.
123cd ../Mesa-7.11./configuremake
You do not actually need to build the full MesaLib at this point, you could interrupt the build after builtin_compiler is built. - Save a copy of builtin_compiler and glsl_compiler:
12cd src/glslcp builtin_compiler builtin_compiler_x86 - Clean the source directory:
12cd ../..make distclean - Start build Mesa for ARM:
12345678CFLAGS="-I/usr/include" \X11_LIBS="-L/home/jaufranc/edev/beagleboard/libs/lib/arm-linux-gnueabi \-lX11" X11_INCLUDES="-I/usr/include" X11_CFLAGS="-I/usr/include" ./configure \--target=arm-linux-gnueabi --host=arm-linux-gnueabi --prefix=/home/jaufranc/edev/beagleboard/libs \--includedir=/home/jaufranc/edev/beagleboard/libs/include/ \--libdir=/home/jaufranc/edev/beagleboard/libs/lib/arm-linux-gnueabi \--libdir=/home/jaufranc/edev/beagleboard/libs/libmake
This should end with an error while building builtin_compiler. - Then copy builtin_compiler_x86 back to builtin_compiler
12cd src/glslcp builtin_compiler_x86 builtin_compiler - Edit the config file configs/current to add the library paths for GL as follows:
1GL_LIB_DEPS = $(EXTRA_LIB_PATH) <strong>-L/home/jaufranc/edev/beagleboard/libs/lib/arm-linux-gnueabi \ -L/usr/arm-linux-gnueabi/lib/</strong> -lX11 -lXext -lm -lpthread -ldl - And keep building:
12makemake install
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:
1 |
make linux-osmesa |
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
Hello, when i excute this tutorial, i am in the 6 steps Configure and build Mesa for x86. ./configure make i get this eroors nouveau_vieux_dri.so.tmp: undefined reference to nouveau_pushbuf_flush' nouveau_vieux_dri.so.tmp: undefined reference to nouveau_bo_pending’ nouveau_vieux_dri.so.tmp: undefined reference to nouveau_pushbuf_marker_undo' nouveau_vieux_dri.so.tmp: undefined reference to nouveau_grobj_autobind’ nouveau_vieux_dri.so.tmp: undefined reference to nouveau_pushbuf_marker_emit' nouveau_vieux_dri.so.tmp: undefined reference to nouveau_bo_unmap’ nouveau_vieux_dri.so.tmp: undefined reference to nouveau_channel_free' nouveau_vieux_dri.so.tmp: undefined reference to nouveau_grobj_free’ nouveau_vieux_dri.so.tmp: undefined reference to nouveau_device_open_existing' nouveau_vieux_dri.so.tmp: undefined reference to nouveau_pushbuf_emit_reloc’ nouveau_vieux_dri.so.tmp: undefined reference to nouveau_device_close' nouveau_vieux_dri.so.tmp: undefined reference to nouveau_channel_alloc’ nouveau_vieux_dri.so.tmp: undefined reference to nouveau_bo_handle_get' nouveau_vieux_dri.so.tmp: undefined reference to nouveau_bo_map’ nouveau_vieux_dri.so.tmp: undefined reference to nouveau_bo_new' nouveau_vieux_dri.so.tmp:… Read more »
I have met some errors during the cross compiling,and could you help me with cross compiling x11