1.安装交叉编译工具链
arm-linux-gcc-4.4.3.tar.gz
2.安装 qt-everywhere-opensource-src-5.6.2.tar.gz
2.1解压
tar -xvf qt-everywhere-opensource-src-5.6.2.tar.gz
2.2 配置
2.2.1 编译 tslib(tslib-1.4.tar.gz)
./autogen.sh
echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache
./configure --host=arm-linux --prefix=$(pwd)/_install --cache-file=arm-linux.cache
make && make install
2.2.2
复制一份 qtbase/mkspecs/linux-arm-gnueabi-g++ 重命名为qtbase/mkspecs/linux-arm-qt
2.2.3
修改 linux-arm-qt 目录下的 qmake.conf
#
# qmake configuration for building with arm-linux-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
#add by
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS_RELEASE += -O2 -march=armv5te # 需要修改对应架构
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv5te # 需要修改对应架构
# modifications to g++.conf
QMAKE_CC = arm-linux-gcc
QMAKE_CXX = arm-linux-g++
QMAKE_LINK = arm-linux-g++
QMAKE_LINK_SHLIB = arm-linux-g++
# modifications to linux.conf
QMAKE_AR = arm-linux-ar cqs
QMAKE_OBJCOPY = arm-linux-objcopy
QMAKE_NM = arm-linux-nm -P
QMAKE_STRIP = arm-linux-strip
load(qt_config)
2.2.4 配置脚本
#!/bin/bash
./configure -prefix $(pwd)/_install \
-debug \
-accessibility \
-xplatform linux-arm-qt \
-qpa linuxfb \
-linuxfb \
-qreal float \
-pch \
-make libs \
-qt-zlib \
-qt-libjpeg \
-qt-libpng \
-qt-freetype \
-no-sse2 \
-no-qml-debug \
-no-glib \
-no-opengl \
-no-xcb \
-no-iconv \
-no-evdev \ #关闭自带触摸事件处理
-nomake tools \
-nomake examples \
-skip qt3d -skip qtcanvas3d -skip qtdoc -skip qtwayland \
-tslib \
-I/home/yu/work/tslib/1.4/tslib/_install/include \
-L/home/yu/work/tslib/1.4/tslib/_install/lib \
2.3 make
2.4 make install
3.安装 qt-opensource-linux-x86-5.6.2.run
./ qt-opensource-linux-x86-5.2.1.run
4.配置QtCreator, 主要设置arm 交叉编译工具和qmake
**********Tools--->Options--->Build&Run--->Comoilers 添加 arm-linux-gcc 路径
**********Tools--->Options--->Build&Run--->Qt Versions 添加 qmake 路径
**********Tools--->Options--->Build&Run--->Kits
5.复制 Qt 库、arm-linux-gcc 库、tslib 库 到 arm机器
#!/bin/sh
export MYDIR=/mnt/sdcard/hwboardlib/lib
#qtlib
ln -s $MYDIR/qtlib/libQt5Bluetooth.so.5.6.2 /lib/libQt5Bluetooth.so
ln -s $MYDIR/qtlib/libQt5Bluetooth.so.5.6.2 /lib/libQt5Bluetooth.so.5
....
....
ln -s $MYDIR/qtlib/libQt5Xml.so.5.6.2 /lib/libQt5Xml.so
ln -s $MYDIR/qtlib/libQt5Xml.so.5.6.2 /lib/libQt5Xml.so.5
ln -s $MYDIR/qtlib/libQt5Xml.so.5.6.2 /lib/libQt5Xml.so.5.6
ln -s $MYDIR/qtlib/libQt5Xml.so.5.6.2 /lib/libQt5Xml.so.5.6.2
#gnueabilib
#ln -s $MYDIR/gnu/ /lib/
ln -s $MYDIR/gnu/ld-2.9.so /lib/ld-2.9.so
...
...
ln -s $MYDIR/gnu/libuuid.so.1.2 /lib/libuuid.so.1.2
#tslib
#ln -s $MYDIR/tslib/ /lib/
ln -s $MYDIR/tslib/arctic2.so /lib/arctic2.so
ln -s $MYDIR/tslib/collie.so /lib/collie.so
ln -s $MYDIR/tslib/corgi.so /lib/corgi.so
........
#配置tslib
export TSLIB_ROOT=$MYDIR/tslib
export TSLIB_CONFFILE=/$MYDIR/tslib/ts.conf
export TSLIB_PLUGINDIR=$TSLIB_ROOT
export TSLIB_TSEVENTTYPE=input
export QWS_MOUSE_PROTO=tslib:/dev/input/event0
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_CALIBFILE=/mnt/nand1-1/pointercal
export POINTERCAL_FILE=/mnt/nand1-1/pointercal
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CONSOLEDEVICE=none
#配置qt插件
export QTDIR=/mnt/sdcard/hwboardlib
#export PATH=$QTDIR/bin:$PATH
export QT_QPA_PLATFORM_PLUGIN_PATH=/mnt/sdcard/hwboardlib
export QT_QPA_GENERIC_PLUGINS=tslib
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=480x272:mmSize=95x53:offset=0x0:tty=/dev/tty1
export QT_QPA_FONTDIR=/mnt/sdcard/hwboardlib/fonts
export LD_PRELOAD=/lib/preloadable_libiconv.so:/lib/libts.so
export LD_LIBRARY_PATH=/lib:$MYDIR/gnu:$MYDIR/qtlib:$MYDIR/tslib:$LD_LIBRARY_PATH
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
###############################################################################
1.编译QT 5.6.2 出现
file not recognized: file truncated。
解决:删除文件目录下的 .o 文件
2.第三方库 tslib 和 QT 自带的evdev 只需要使能一个即可
-no-evdev 关闭QT 自带evdev库
3. libiconv-1.14.tar.gz
需要编译此库文件