移植qt5.5

平台:TQIMX6Q_coreC
下载以下文件:
qt-everywhere-opensource-src-5.5.1.tar.gz
tslib-1.1.tar
openssl-1.0.2n.tar.bz2
1.这里使用的交叉编译器是5.3.1

service@service:/cd_source/miao/qt5.5.1/qt5.5.1/src$ arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/opt/EmbedSky/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/../libexec/gcc/arm-linux-gnueabihf/5.3.1/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: /home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/snapshots/gcc-linaro-5.3-2016.02/configure SHELL=/bin/bash --with-bugurl=https://bugs.linaro.org --with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu --with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld --disable-libstdcxx-pch --disable-libmudflap --with-cloog=no --with-ppl=no --with-isl=no --disable-nls --enable-c99 --with-tune=cortex-a9 --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-multilib --enable-multiarch --with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/sysroots/arm-linux-gnueabihf --enable-lto --enable-linker-build-id --enable-long-long --enable-shared --with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu/arm-linux-gnueabihf/libc --enable-languages=c,c++,fortran,lto --enable-checking=release --disable-bootstrap --with-bugurl=https://bugs.linaro.org --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=arm-linux-gnueabihf --prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnu
Thread model: posix
gcc version 5.3.1 20160113 (Linaro GCC 5.3-2016.02) 

2.分别解压qt-everywhere-opensource-src-5.5.1.tar.gz、tslib-1.1.tar、openssl-1.0.2n.tar.bz2

service@service:/cd_source/miao/qt5.5.1/qt5.5.1/src$ ls
busybox-1.25.1.tar.bz2  openssl-1.0.2n.tar.bz2              qt-everywhere-opensource-src-5.5.1.tar.gz  tslib-1.1.tar
openssl-1.0.2n          qt-everywhere-opensource-src-5.5.1  tslib-1.1

3.进入交叉编译器路径新建文件夹sysroot_openil用于存放产生的库文件
/opt/EmbedSky/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/sysroot_openil
4.编译tslib,新建build.sh脚本执行

#!/bin/bash
./autogen.sh
#INSTALL_DIR=/opt/EmbedSky/linaro-4.9/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/sysroot
INSTALL_DIR=/opt/EmbedSky/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/sysroot_openil
#INSTALL_DIR=/disk4/qt_source/qt5.5.1/source/tslib-1.1/__install
echo "ac_cv_func_malloc_0_nonnull=yes">arm-linux-gnueabi.cache

./configure --prefix=${INSTALL_DIR} --host=arm-linux-gnueabi  --cache-file=arm-linux-gnueabi.cache CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabi-g++ &&
mkdir -p $INSTALL_DIR
make &&
make install

5.编译openssl-1.0.2n,新建build.sh执行

    #!/bin/bash
    export CROSS_COMPILE=arm-linux-gnueabihf-
    #export INSTALL_PATH=/opt/EmbedSky/linaro-4.9/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/sysroot
    export INSTALL_PATH=/opt/EmbedSky/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/sysroot_openil
    CC=gcc CROSS_COMPILE=${CROSS_COMPILE} ./Configure android-armv7 --prefix=${INSTALL_PATH}/usr no-dso no-asm shared no-engine &&
    perl crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h &&
    sed -i 's/-mandroid/ /g' Makefile
    make ${CPU_NUM}  && 

make install

6.编译qt-everywhere-opensource-src-5.5.1,新建文件夹arm_build,编写一个脚本,如下

#!/bin/bash

#CROSS_TOOLCHAIN_PATH=/opt/EmbedSky/linaro-4.9/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/sysroot
CROSS_TOOLCHAIN_PATH=/opt/EmbedSky/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/sysroot_openil
#CROSS_TOOLCHAIN_PATH=/opt/EmbedSky/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/
export PKG_CONFIG_PATH=${CROSS_TOOLCHAIN_PATH}/usr/lib/pkgconfig
#export PKG_CONFIG_LIBDIR=${CROSS_TOOLCHAIN_PATH}/usr/lib/pkgconfig
#export PKG_CONFIG_SYSROOT_DIR=${CROSS_TOOLCHAIN_PATH}
../configure --prefix=${CROSS_TOOLCHAIN_PATH}/usr --bindir=${CROSS_TOOLCHAIN_PATH}/usr/bin --libexecdir=${CROSS_TOOLCHAIN_PATH}/usr/lib/dbus-glib --datadir=${CROSS_TOOLCHAIN_PATH}/usr/share --sysconfdir=${CROSS_TOOLCHAIN_PATH}/etc --libdir=${CROSS_TOOLCHAIN_PATH}/usr/lib  \
-confirm-license -opensource -release -make libs -xplatform linux-arm-gnueabi-g++ -optimized-qmake -pch \
-qt-libjpeg -qt-libpng -qt-zlib \
-gui \
-no-opengl \
-openssl \
-no-sse2 \
-no-cups \
-no-glib \
-no-xcb \
-no-separate-debug-info \
-tslib -mtdev \
-I${CROSS_TOOLCHAIN_PATH}/include -L${CROSS_TOOLCHAIN_PATH}/lib -I${CROSS_TOOLCHAIN_PATH}/usr/include -L${CROSS_TOOLCHAIN_PATH}/usr/lib \
-nomake tools -nomake tests -no-iconv -v
make -j8
make install

如果提示编译器出错,修改arm_build文件夹下文件
vi ./qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf 修改生成Makefile的编译器linux-arm-gnueabihf-g++
编译过程稍久,编译完成后查看前面在编译器路径下的sysroot_openil,生成一系列文件夹

service@service:/cd_source/miao/qt5.5.1/qt5.5.1/src$ ls /opt/EmbedSky/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/sysroot_openil
bin  etc  include  lib  usr

将lib目录下的库拷贝到文件系统/lib目录下;
将etc目录下的文件拷贝到文件系统/etc目录下;
将include目录下文件拷贝到文件系统/include目录下;
将bin目录下的操作命令拷贝到文件系统/bin目录下;
将usr目录下的操作命令拷贝到文件系统/usr目录下;
7.编译qt demo

/opt/EmbedSky/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/sysroot_openil//usr/bin/qmake tqPainter.pro
make

8.将qt_demo放入文件系统开机启动脚本/etc/embedsky_conf,使其开机自启动

 /opt/tqPainter &

显示正常,环境移植完成。

9.相关错误
如果运行程序时,出现错误

This application failed to start because it could not find or load the Qt platform plugin “xcb” 
in “”. 
Reinstalling the application may fix this problem 
Aborted (core dumped)

则需要在执行时添加参数./tqPainter -platform linuxfb,或者修改qt环境QT_QPA_PLATFORM=linuxfb
如果提示

QFontDatabase: Cannot find font directory /opt/EmbedSky/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/sysroot_openil/usr/lib/fonts - is Qt installed correctly?

修改qt环境export QT_QWS_FONTDIR=/usr/lib/fonts
以下为qt5.5.1的qt环境配置

[root@OpenIL:~]# cat /etc/embedsky_conf 
#!/bin/sh -e
#
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.


export DISPLAY=:0.0 

export QT_QPA_PLATFORM=linuxfb

export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1 


                                  echo 16 > /sys/class/graphics/fb0/bits_per_pixel

if [ -n /dev/touchscreen0 ] ; then
        export set TOUCH_DEVICE=/dev/touchscreen0
        export QT_QPA_GENERIC_PLUGINS=tslib:${TOUCH_DEVICE}
else 
        export set TOUCH_DEVICE=/dev/touchscreen0
fi

export set TSLIB_TSDEVICE=${TOUCH_DEVICE}
export set TSLIB_CONFFILE=/etc/ts.conf
export set TSLIB_PLUGINDIR=/lib/ts
export set TSLIB_CALIBFILE=/etc/pointercal
export set TSLIB_CONSOLEDEVICE=none
export set TSLIB_FBDEVICE=/dev/fb0
export QT_PLUGIN_PATH=/usr/plugins
export LD_LIBRARY_PATH=/usr/lib
export QT_QPA_FONTDIR=/usr/lib/fonts

 #/usr/share/qt5everywheredemo-1.0/QtDemo &
/opt/tqPainter &
[root@OpenIL:~]# 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值