交叉编译Mesa,X11lib,Qt opengl

记录Mesa配置文件如下:

Mesa版本:Mesa-10.2.3

CC=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-gcc CXX=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-g++ ./configure --prefix=/home/work/DownLoad/Mesa --target=arm-linux --host=arm-linux --enable-gles2 --enable-gles1 --disable-glx --enable-egl --disable-dri --enable-shared-glapi --with-egl-platforms=fbdev --with-dri-drivers=swrast
或者
unset PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/home/work/DownLoad/presen/lib/pkgconfig:/home/work/DownLoad/libdrm/lib/pkgconfig
CC=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-gcc CXX=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-g++ ./configure --target=arm-linux --host=arm-linux --prefix=/home/work/DownLoad/Mesa-10.0 --enable-gl --enable-gles2 --enable-gles1 --enable-opengl --enable-shared-glapi --disable-dri --enable-shared-dricore --enable-gles1 --enable-opengl --enable-gallium-egl --with-egl-platforms=fbdev --with-gallium-drivers=swrast --with-dri-drivers=swrast CFLAGS="-I/home/work/DownLoad/libudev/include -L/home/work/DownLoad/libudev/lib/arm-linux-gnueabi"
make &&make install

Qt配置:

./configure -prefix /usr/local/qt-5.2.1-embedded-arm-quick -release -opensource -qt-libpng -qt-libjpeg -plugin-sql-sqlite -widgets -qt-sql-sqlite -make libs -no-cups -no-nis -no-iconv -no-dbus -no-openssl -no-iconv -no-accessibility -no-javascript-jit -no-sse2 -silent -xplatform  linux-arm-gnueabi-g++  -nomake tools -nomake examples -nomake tests -qt-freetype -opengl es2  -qreal float -no-glib -strip -xinput2 -linuxfb -plugindir /usr/local/qt-5.2.1-embedded-arm-quick/plugin -qmldir /usr/local/qt-5.2.1-embedded-arm-quick/qml -importdir /usr/local/qt-5.2.1-embedded-arm-quick/imports  -L/home/work/DownLoad/Mesa/lib -I/home/work/DownLoad/Mesa/include -confirm-license "$@" -verbose
make && make install
qmake.conf中需要加入:QMAKE_LIBS_OPENGL_ES2 = -lglapi -lGLESv2 -lEGL
这是由于libGLESv2.so依赖于libglapi.so,可以用arm-none-linux-gnueabi-ld查看关系库的依赖关系。Mesa交叉编译的时候如果没有 --enable-shared-glapi,则会报如下错误:
libGLESv2.so: undefined reference to '_glapi_get_dispatch'
libGLESv2.so: undefined reference to'_glapi_Dispatch' 


XLib所有源码下载地址:

http://cgit.freedesktop.org/xorg/

http://cgit.freedesktop.org/xorg/

ubuntu 命令行批量下载: wget -r -np -nd ftp://mirrors.go-part.com/xorg/X11R7.7/


记录LibX11-1.3.2的配置如下:

echo enable_malloc0returnsnull=yes>arm-linux.cache
这一句是为了保证可以交叉编译,不然交叉编译的时候test是不会过的,会报如下错误:

checking whether malloc(0) returns NULL... configure: error: in `/home/work/DownLoad/libX11-1.3.2':
configure: error: cannot run test program while cross compiling

这是由于xlib在使用--host=arm-linux的时候禁止交叉编译。解决方法为从congfirue中找到报错的那一句,查看具有+set的那一句脚本,例如本例中为:

vim configure
查找checking whether malloc(0) returns Null...这一句,得到以下信息
# Check whether --enable-malloc0returnsnull was given.
if test "${enable_malloc0returnsnull+set}" = set; then
  enableval=$enable_malloc0returnsnull; MALLOC_ZERO_RETURNS_NULL=$enableval
else
  MALLOC_ZERO_RETURNS_NULL=auto
fi


{ $as_echo "$as_me:$LINENO: checking whether malloc(0) returns NULL" >&5
$as_echo_n "<span style="color:#FF0000;">checking whether malloc(0) returns NULL... " >&6; }
if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
        if test "$cross_compiling" = yes; then
  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
See \`config.log' for more details." >&5
$as_echo "$as_me: error: cannot run test program while cross compiling
See \`config.log' for more details." >&2;}

由于他是在 if test "${enable_malloc0returnsnull+set}" = set;

故而将enable_malloc0returnsnull=yes

并将其写入cache文件中。

以后遇到checking**************,configure: error: cannot run test program while cross compiling,类似错误的时候可以一样的解决。

最终交叉编译的configLibX11,sh如下:

make clean && make distclean
rm -rf arm-linux.cache
echo enable_malloc0returnsnull=yes>arm-linux.cache
CC=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-gcc CXX=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-g++ ./configure --prefix=/home/work/DownLoad/libX11/ --disable-xf86bigfont --host=arm-linux --target=arm-linux  CFLAGS="-I/home/work/DownLoad/libX11/include -I/home/work/DownLoad/libX11/libxcb/include -L/home/work/DownLoad/libX11/lib -L/home/work/DownLoad/libX11/libxcb/lib" --includedir=/home/work/DownLoad/libX11/include XPROTO_LIBS=/home/work/DownLoad/libX11/lib --cache-file=arm-linux.cache
make && make install
 
CFLAGS="-I/home/work/DownLoad/libX11/include -L/home/work/DownLoad/libX11/lib",这句制定xPorto的路径,因为需要用到xProto中的x.h
 

交叉编译X11需要交叉编译Xproto(版本xproto-7.0.17):

Xporto下载地址:

http://cgit.freedesktop.org/xorg/proto/xproto/
configXproto.sh如下:
CC=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-gcc CXX=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-g++ ./configure --prefix=/home/work/DownLoad/libX11/ --host=arm-linux --target=arm-linux
make && make install

由于需要用到Xtrans.h,故而需要下载xtrans,下载地址为:

http://www.x.org/releases/X11R7.5/src/lib/
我所选的版本为:xtrans-1.2.5

交叉编译和上面的类似

CC=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-gcc CXX=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-g++ ./configure --prefix=/home/work/DownLoad/libX11/ --host=arm-linux --target=arm-linux --cache-file=arm-linux.cache
make && make install

由于报错XKB.c:36:37: fatal error: X11/extensions/XKBproto.h: No such file or directory,故而还需要用到kbproto-1.0.6

kbproto-1.0.6下载地址:

http://cgit.freedesktop.org/xorg/proto/kbproto/
kbproto-1.0.6交叉编译和上面的类似:

make clean && make distclean
rm -rf configure
./autogen.sh
CC=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-gcc CXX=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-g++ ./configure --prefix=/home/work/DownLoad/libX11/kbproto --host=arm-linux --target=arm-linux 
make && make install

需要XI.h,需要下载inputproto-2.1.99.6,下载地址为:
http://cgit.freedesktop.org/xorg/proto/inputproto/

iputProto-2.1.99.6交叉编译和上面类似

make clean && make distclean
rm -rf configure
./autogen.sh
CC=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-gcc CXX=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-g++ ./configure --prefix=/home/work/DownLoad/libX11/inputporto/ --host=arm-linux --target=arm-linux
错误:../include/X11/Xlib-xcb.h:7:21: fatal error: xcb/xcb.h: No such file or directory
需要下载libXcb,下载地址
http://xcb.freedesktop.org/dist/
libxcb-1.8.1交叉编译如下:
export PKG_CONFIG_PATH=/home/work/DownLoad/libX11/xcbproto/lib/pkgconfig
make clean && make distclean
rm -rf arm-linux.cache
echo ac_cv_path_XSLTPROC=/home/work/DownLoad/libX11/libxslt/bin > arm-linux.cache
CC=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-gcc CXX=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-g++ ./configure --prefix=/home/work/DownLoad/libX11/libxcb/ CFLAGS="-I/home/work/DownLoad/libX11/libxslt/include -I/home/work/DownLoad/libX11/LibXau/include -I/home/work/DownLoad/libX11/include -L/home/work/DownLoad/libX11/libxslt/lib -L/home/work/DownLoad/libX11/LibXau/lib" --host=arm-linux --target=arm-linux --cache-file=arm-linux.cache
错误信息:configure: error: XCB requires xsltproc

下载xsltproc,下载地址:

https://git.gnome.org/browse/libxslt/
<pre name="code" class="html">CC=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-gcc CXX=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-g++ ./configure --with-libxml-libs-prefix=/home/work/DownLoad/libX11/libxml2/lib --with-libxml-include-prefix=/home/work/DownLoad/libX11/include/libxml2/libxml/ --prefix=/home/work/DownLoad/libX11/libxslt/ --host=arm-linux --target=arm-linux

如果已经交叉编译并且已经指定libxml2的路径,然而还是找不到libxml2,可以将在congfigure中手动指出xml的路径
LIBXML_CONFIG_PREFIX="/home/work/DownLoad/libX11/libxml2"

 xsltproc需要下载libxml,下载地址: 
ftp://xmlsoft.org/libxml2/
交叉编译和上面的类似

xcb需要xcb-proto,下载地址:http://xcb.freedesktop.org/dist/
xcb-proto-1.7交叉编译如下:
CC=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-gcc CXX=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-g++ ./configure --prefix=/home/work/DownLoad/libX11/xcbproto/ --host=arm-linux --target=arm-linux
make && make install
xcb需要libxau,下载地址:http://cgit.freedesktop.org/xorg/lib/libXau/
libXau-1.0.7交叉编译:
make clean && make distclean
rm -rf configure
./autogen.sh
CC=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-gcc CXX=/usr/local/arm-4.8.1/bin/arm-none-linux-gnueabi-g++ ./configure --prefix=/home/work/DownLoad/libX11/LibXau/ --host=arm-linux --target=arm-linux CFLAGS="-I/home/work/DownLoad/libX11/include"
make && make instal
 


附录一下交叉编译成功后的lib库的下载地址,用以以后下载使用:

http://download.csdn.net/detail/mkndg/7738667


  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 11
    评论
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值