==> Thursday, August 1, 2013 <==

Cross Compile Mesa 9.1.5 without X11




Recently I try to add opengl support for our embeded project, at least software emulated support. So I try to cross compile the mesa3d library. There are tons errors about X11 related stuffs missing, but we do not need the X11 support! After a long and difficult journey, I found the way to compile it without X11 and with framebuffer only.

You must enable the dri options, otherwise it will report

/mesa/lib/libGLESv2.so: undefined reference to `_glapi_Dispatch' or something else. 
Because the glapi will not compile without dri. 
 
See references:
 
https://bugs.freedesktop.org/show_bug.cgi?id=61750

The compile commands :

export TOOLCHAIN_TARGET_SYSTEM=arm-none-linux-gnueabi
export  TOOLCHAIN_INSTALL_DIRECTORY=/opt/toolchain

./configure CPPFLAGS=-DMESA_EGL_NO_X11_HEADERS CFLAGS=-DMESA_EGL_NO_X11_HEADERS CC=$TOOLCHAIN_TARGET_SYSTEM-gcc CXX=$TOOLCHAIN_TARGET_SYSTEM-g++ --build=$TOOLCHAIN_BUILD_SYSTEM --target=$TOOLCHAIN_TARGET_SYSTEM --host=$TOOLCHAIN_TARGET_SYSTEM --prefix=$TOOLCHAIN_INSTALL_DIRECTORY --enable-opengl --enable-gles2 --enable-gles1 --disable-glx --enable-egl --enable-gallium-egl --enable-dri --with-dri-drivers=swrast --with-gallium-drivers=swrast --with-egl-platforms=fbdev --disable-xorg --disable-xa --disable-xlib-glx

Commands Explanation:

If without MESA_EGL_NO_X11_HEADERS defined, there will cause compile errors because without X11 headers, and we do not have any other better options to disable the X11 using, see "include/EGL/eglplatform.h". So we just defined the macro to avaid this suitation.












Cross Compile ICU 51.2




The IBM ICU library can not simply invoke configure to finish the cross-compilation, we should do some steps to process it.

We assume you have already downloaded and unpacked ICU 51.2 to "/opt/icu"

1. Compile icu for current operating system
ICU need some stuffs from ICU which compiled for current operatoin system, so we satisfy it's requirement.

First, we make an icu source copy :

cp -rfd /opt/icu /opt/icu_prebuild

Secondary, we compile it for current opearting system :

cd /opt/icu_prebuild/source
./configure
make

2. We could now cross compile our ICU library now!

export TOOLCHAIN_TARGET_SYSTEM=arm-none-linux-gnueabi
export TOOLCHAIN_INSTALL_DIRECTORY=/opt/toolchain

cd /opt/icu/source
./configure CC=$TOOLCHAIN_TARGET_SYSTEM-gcc CXX=$TOOLCHAIN_TARGET_SYSTEM-g++ CPP=$TOOLCHAIN_TARGET_SYSTEM-cpp --host=$TOOLCHAIN_TARGET_SYSTEM --prefix=$TOOLCHAIN_INSTALL_DIRECTORY --enable-shared=yes --enable-tests=no --enable-samples=no --with-cross-build=/opt/icu_prebuild/source
make

NOTICE: Do not try to compile the static version of ICU, seems that would cause some errors.