==> 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.











1 comments:

Unknown said...

hai i have followed your tutorial but when i run "make" , i have a problem

make all-am
make[3]: Entering directory '/media/daunbiru/DATA/GLUT/Mesa-9.1.5/src/mapi/es1api'
CC entry.lo
CCLD libGLESv1_CM.la
/usr/local/lib/libdrm.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
Makefile:579: recipe for target 'libGLESv1_CM.la' failed
make[3]: *** [libGLESv1_CM.la] Error 1
make[3]: Leaving directory '/media/daunbiru/DATA/GLUT/Mesa-9.1.5/src/mapi/es1api'
Makefile:507: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/media/daunbiru/DATA/GLUT/Mesa-9.1.5/src/mapi/es1api'
Makefile:463: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/media/daunbiru/DATA/GLUT/Mesa-9.1.5/src'
Makefile:561: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
daunbiru@daunbiru:/media/daunbiru/DATA/GLUT/Mesa-9.1.5$

Post a Comment