基于Hisi3521DV200平台移植Qt4.8.6
近日,因方案变更,需要移植Qt4.8.6到Hisi3521DV200平台上;而之前开发的GUI界面,都没有触摸功能,本次开发打算将触摸功能也一并实现。
1.安装交叉编译链arm-himix400-linux-g++:
- 一般HIsiSDK包都有交叉编译链与安装指导,不做赘述。
2.交叉编译,安装tslib
3.下载Qt源码:
- 下载链接:http://download.qt.io/archive/qt/4.8/4.8.6/
- 源码包:qt-everywhere-opensource-src-4.8.6.tar.gz
4.解压Qt,并修改io.pri文件:src/corelib/io/io.pri
-
从 linux-*:!symbian { SOURCES += \ io/qfilesystemwatcher_inotify.cpp \ io/qfilesystemwatcher_dnotify.cpp HEADERS += \ io/qfilesystemwatcher_inotify_p.h \ io/qfilesystemwatcher_dnotify_p.h } 改为 linux-*|arm-himix400-linux-*:!symbian { SOURCES += \ io/qfilesystemwatcher_inotify.cpp \ io/qfilesystemwatcher_dnotify.cpp HEADERS += \ io/qfilesystemwatcher_inotify_p.h \ io/qfilesystemwatcher_dnotify_p.h }
5.创建专属arm-himix400-linux-g++编译链的qmake.conf文件
- 创建arm-himix400-linux-g++的qmake.cof文件: cp mkspecs/qws/linux-arm-gnueabi-g++/ mkspecs/qws/arm-himix400-linux-g++/ -r
- 修改mkspecs/qws/arm-hisiv300-linux-g++/qmake.conf文件,如下:
-
# # qmake configuration for building with arm-none-linux-gnueabi-g++ # include(../../common/linux.conf) include(../../common/gcc-base-unix.conf) include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf QMAKE_CC = /opt/hisi-linux/x86-arm/arm-himix400-linux/bin/arm-himix400-linux-gcc -lts QMAKE_CXX = /opt/hisi-linux/x86-arm/arm-himix400-linux/bin/arm-himix400-linux-g++ -lts QMAKE_LINK = /opt/hisi-linux/x86-arm/arm-himix400-linux/bin/arm-himix400-linux-g++ -lts QMAKE_LINK_SHLIB = /opt/hisi-linux/x86-arm/arm-himix400-linux/bin/arm-himix400-linux-g++ -lts # modifications to linux.conf QMAKE_AR = /opt/hisi-linux/x86-arm/arm-himix400-linux/bin/arm-himix400-linux-ar cqs QMAKE_OBJCOPY = /opt/hisi-linux/x86-arm/arm-himix400-linux/bin/arm-himix400-linux-objcopy QMAKE_STRIP = /opt/hisi-linux/x86-arm/arm-himix400-linux/bin/arm-himix400-linux-strip load(qt_config)
6.设定交叉编译配置参数
-
./configure \ -opensource \ --prefix=/opt/qt4.8.6_a15 \ -confirm-license \ -qt-sql-sqlite \ -qt-gfx-linuxfb \ -qt-gfx-transformed \ -plugin-sql-sqlite \ -no-qt3support \ -no-phonon \ -no-svg \ -no-webkit \ -no-script \ -no-scripttools \ -no-declarative \ -no-declarative-debug \ -qt-zlib \ -qt-libtiff \ -qt-libpng \ -no-libmng \ -qt-libjpeg \ -no-rpath \ -no-pch \ -no-3dnow \ -no-avx \ -no-neon \ -no-openssl \ -no-nis \ -no-cups \ -no-dbus \ -embedded arm \ -platform linux-g++ \ -xplatform qws/arm-himix400-linux-g++ \ -little-endian \ -qt-freetype \ -no-opengl \ -no-glib \ -nomake demos \ -nomake examples \ -nomake docs \ -nomake tools \ -nomake accessible \ -qt-mouse-tslib \ -L/home/newbie/Desktop/tslib/arm-himix400-linux-target/lib \ -I/home/newbie/Desktop/tslib/arm-himix400-linux-target/include
7.编译与安装
- make && make install
8.问题与处理方法
- 问题
Makefile:2519: recipe for target '.obj/release-shared-emb-arm/itemviews.o' failed make[3]: *** [.obj/release-shared-emb-arm/itemviews.o] Error 1 make[3]: Leaving directory '/home/newbie/Desktop/qt-everywhere-opensource-src-4.8.6/src/plugins/accessible/widgets' Makefile:39: recipe for target 'sub-widgets-make_default' failed make[2]: *** [sub-widgets-make_default] Error 2 make[2]: Leaving directory '/home/newbie/Desktop/qt-everywhere-opensource-src-4.8.6/src/plugins/accessible' Makefile:246: recipe for target 'sub-accessible-make_default' failed make[1]: *** [sub-accessible-make_default] Error 2 make[1]: Leaving directory '/home/newbie/Desktop/qt-everywhere-opensource-src-4.8.6/src/plugins' Makefile:448: recipe for target 'sub-plugins-make_default-ordered' failed make: *** [sub-plugins-make_default-ordered] Error 2
- 解决方案
-
因之前的arm-hisiv300-linux-*与arm-hisiv500-linux-*都没有遇到这种情况,一开始束手无策。
- 从以上报错信息能够看出,在目录/home/newbie/Desktop/qt-everywhere-opensource-src-4.8.6/src/plugins/accessible/widgets编译报错。
- cd /home/newbie/Desktop/qt-everywhere-opensource-src-4.8.6/src/plugins/accessible/widgets && make
- 根据报错内容,修改文件itemviews.cpp:
从
bool QAccessibleTable2::unselectColumn(int column) { if (!view()->model() || !view()->selectionModel()) return false; QModelIndex index = view()->model()->index(0, column, view()->rootIndex()); if (!index.isValid() || view()->selectionMode() & QAbstractItemView::NoSelection) return false; view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect); return true; } 改为: bool QAccessibleTable2::unselectColumn(int column) { if (!view()->model() || !view()->selectionModel()) return false; QModelIndex index = view()->model()->index(0, column, view()->rootIndex()); if (!index.isValid() || view()->selectionMode() & QAbstractItemView::NoSelection) return false; view()->selectionModel()->select(index,QItemSelectionModel::SelectionFlags(QItemSelectionModel::Columns & QItemSelectionModel::Deselect)); return true; } -
重新编译安装,即可。