移植QT5.6到ARM&&QT5.6的交叉编译

准备包:

arm-linux-gcc-4.5.1-v6-vfp-20101103.gz              下载:https://download.csdn.net/download/lyj548926543/10877194

tslib-1.4.tar.gz                                                       下载:https://download.csdn.net/download/lyj548926543/10877155

qt-everywhere-opensource-src-5.6.1.tar.gz         下载:http://download.qt.io/official_releases/qt/5.6/5.6.1/single/

 

1安装arm-linux-gcc-4.5.1-v6-vfp-20101103.gz 

tar zxvf arm-linux-gcc-4.5.1-v6-vfp-20101103.gz -C /usr/local/ARM

#vim /etc/profile

增加路径设置,在末尾添加如下,保存

export PATH=$PATH:/usr/local/ARM/4.5.1/bin

source /etc/profile

检测环境:arm-linux-gcc -v

 

2.tslib-1.4.tar.gz 交叉编译

tar -zxvf tslib-1.4.tar.gz

cd tslib

./autogen-clean.sh    //(每次在编译失败后都要执行,这是清除作用)

./autogen.sh

./autogen.sh:4:autoreconf:not found 错误

sudo apt-get install autoconf automake libtool

./autogen-clean.sh

./autogen.sh

mkdir /home/qt/tslib1.4       //(库的安装路径)

./configure   --host=arm-none-linux-gnueabi  ac_cv_func_malloc_0_nonnull=yes 

 --cache-file=arm-linux.cache   -prefix=/home/ubuntu/qt/tslib1.4

注意

--host=arm-none-linux-gnueabi(指定交叉工具链,可根据需要修改)

--prefix=/home/ubuntu/tslib/Arm-tslib(指定安装目录,可根据需要修改)

 

在/tests/ts_calibrate.c中加入open的第三个参数0777,否则make时会出现错误

即:vim tests/ts_calibrate.c

修改227行和229行

if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {

    cal_fd = open (calfile, O_CREAT | O_RDWR, 0777);

} else {

    cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR, 0777);

}

make

make install

 

3QT5.6的交叉编译

 

 mkdir /home/qt/qt5.7/qt5.6

 mkdir /home/qt/qt5.7/arm-qt

qt-everywhere-opensource-src-5.6.1.tar.gz放在/home/qt/qt5.7/qt5.6

tar -xzvf qt-everywhere-opensource-src-5.6.1.tar.gz

cp -r /home/qt/tslib1.4 /home/qt/qt5.7

cd/home/qt/qt5.7/qt5.6/qt-everywhere-opensource-src-5.6.1

修改

vi qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf

创建shell脚本

vi auto.sh

   #!/bin/sh
  1     ¦   ¦   ./configure \
  2     ¦   ¦   -prefix /home/qt/qt5.7/arm-qt/ \
  3     ¦   ¦   -release \
  4     ¦   ¦   -opensource \
  5     ¦   ¦   -confirm-license \
  6     ¦   ¦   -xplatform linux-arm-gnueabi-g++ \
  7     ¦   ¦   -shared \
  8     ¦   ¦   -qt-zlib \
  9     ¦   ¦   -no-opengl \
 10     ¦   ¦   -no-dbus \
 11     ¦   ¦   -no-openssl \
 12     ¦   ¦   -no-nis \
 13     ¦   ¦   -no-cups \
 14     ¦   ¦   -no-glib \
 15     ¦   ¦   -no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 \
 16     ¦   ¦   -no-avx \
 17     ¦   ¦   -nomake tools \
 18     ¦   ¦   -qreal float \
 19     ¦   ¦   -qt-libpng \
 20     ¦   ¦   -tslib \
 21     ¦   ¦   -nomake examples \
 22     ¦   ¦   -I /opt/tslib1.4/include \
 23     ¦   ¦   -L/opt/tslib1.4/lib
 24 
 25 
 26     exit
~              

注意:每行最后 都要加上 \ 与前面命令有空格键; 

否则会出现  ****  command not found

chmod 777 auto.sh

./auto.sh

make  //时间较长。大概需要俩小时

make install

生成文件  //绿色为我自己移进去的 可执行文件

4生成arm可执行文件

进入工程文件

cd /home/hehe/myswlfWord

生成 pro

/home/qt/qt5.7/arm-qt/bin/qmake -project

编辑myswlfWord.pro 引入所用到的模块

生成的是没有模块的

加上:

/home/qt/qt5.7/arm-qt/bin/qmake          生成Makefile 文件

make     生成ARM可执行 文件

file myswlfWord

 NFS的安装

安装NFS
apt-get install nfs-kernel-server
设置/etc/exports配置文件
vi /etc/exports
添加共享文件

 

配置文件生效

service nfs-kernel-server restart

挂载

设置IP

 ping 宿主机 

 挂载命令 mount -t nfs -o nolock 192.168.60.***:/home/qt /mnt/nfs  (ip为你宿主机ip)

 在qt5.7/arm-qt文件下 进行 ARM 端环境变量设置,

export QT_ROOT=$PWD
export TSLIB_ROOT=../tslib1.4/
export  TSLIB_FBDEVICE=/dev/fb0
export  TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_CONFFILE=$PWD/etc/ts.conf
export  QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event0
export QT_QWS_FONTDIR=$PWD/lib/fonts
export  QT_QPA_PLATFORM_PLUGIN_PATH=$PWD/plugins
export  QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export  TSLIB_CALIBFILE=/etc/pointercal
export  QT_PLUGIN_PATH=$PWD/plugins
export  LD_LIBRARY_PATH=$PWD/lib 
export  LD_LIBRARY_PATH=../tslib1.4/lib/
export  LD_PRELOAD=$PWD/lib/libts.so

./运行 

 运行成功:

 开发板上显示

 

遇到的问题:

原本想移植qt5.7.0 ,在移植的过程中遇到了问题

cc1plus: error: unrecognized command line option "-std=gnu++11"
Makefile:180: recipe for target 'c++11.o' failed
make: *** [c++11.o] Error 1
C++11 disabled.
ERROR: Qt requires a C++11 compiler and yours does not seem to be that.
Please upgrade.

原因是:Qt5.7的版本连编译的时候都要gcc编译器支持c++11才能通过configure

所以换成了Qt5.6的版本

./auto.h  也就是configure时

-release command not fout

原因是 -prefix /home/qt/qt5.7/arm-qt/ \ 后没有 \

    QIconvCodec::convertFromUnicode: usingLatin-1 for conversion, iconv_open failed
     QIconvCodec::convertToUnicode: using Latin-1for conversion, iconv_open failed​

     缺少 libiconv       下载:https://download.csdn.net/download/lyj548926543/10877738

进行交叉编辑

mkdir home/qt/qt5.7/_install

./configure --host=arm-linux --prefix=/home/qt/qt5.7/_install

make

make install

 cp /home/qt/qt5.7/_install/preloadable_libiconv.so   /home/qt/qt5.7/arm-qt/lib/

 

错误:缺少软件

经过两天的奋斗,终于编译好了,中间出来错误不断;到最后一一的解决了;在此要感谢https://blog.csdn.net/qq_38446366/article/details/79579447 这位博主;

相关连接:http://blog.51cto.com/11289337/1929046

https://blog.csdn.net/niepangu/article/details/69486198

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值