QT5.14.2 交叉编译

源码准备

  • QT源码:https://mirrors.tuna.tsinghua.edu.cn/qt/official_releases/qt/5.14/5.14.2/
  • 交叉编译器(Linaro GCC 7.5-2019.12) 7.5.0:https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/

触摸屏支持

  • tslib
    tslib-1.22
    ./configure --prefix=/opt/tslib --host=arm-linux CC=arm-linux-gnueabihf-gcc --enable-static

源码配置和编译

  • 修改交叉编译配置
    gedit qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf
#
# qmake configuration for building with arm-linux-gnueabi-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)

QMAKE_INCDIR += /opt/tslib/include
QMAKE_LIBDIR += /opt/tslib/lib

# modifications to g++.conf
QMAKE_CC                = arm-linux-gnueabihf-gcc
QMAKE_CXX               = arm-linux-gnueabihf-g++
QMAKE_LINK              = arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB        = arm-linux-gnueabihf-g++

# modifications to linux.conf
QMAKE_AR                = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY           = arm-linux-gnueabihf-objcopy
QMAKE_NM                = arm-linux-gnueabihf-nm -P
QMAKE_STRIP             = arm-linux-gnueabihf-strip
load(qt_config)
  • 进入QT源码目录执行编译
    静态编译需要添加-static -static-runtime
#!/bin/sh
./configure -confirm-license \
    -xplatform linux-arm-gnueabi-g++ \
    -opensource \
    -verbose \
    -skip qt3d \
    -skip qtquickcontrols \
    -skip qtwebchannel \
    -skip qtactiveqt \
    -skip qtandroidextras \
    -skip qtdeclarative \
    -skip qtimageformats \
    -skip qtmacextras \
    -skip qtx11extras \
    -skip qtxmlpatterns \
    -skip qtconnectivity \
    -skip qtdoc \
    -skip qtgraphicaleffects \
    -skip qtlocation \
    -skip qtmultimedia \
    -skip qtsensors \
    -skip qttools \
    -skip qttranslations \
    -skip qtwayland \
    -skip qtwebchannel \
    -skip qtwebengine \
    -skip qtwinextras \
    -nomake examples \
    -no-opengl \
    -widgets \
    -recheck-all \
    -no-iconv \
\
    -static \
    -static-runtime \
    -tslib \
    -I/opt/tslib/include \
    -L/opt/tslib/lib \
    -prefix /opt/Qt5.14_arm_linux_static

使用

export QTDIR=$cur_path/zynq-$PETALINUX_VER:$QTEDIR
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
qmake
make

export TSLIB_ROOT=/home/root/ui/tslib                                          
export TSLIB_TSDEVICE=/dev/input/event0 
export TSLIB_CALIBFILE=/etc/pointercal   
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf    
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts  
export TSLIB_FBDEVICE=/dev/fb0   
export TSLIB_CONSOLEDEVICE=none  
export LD_LIBRARY_PATH=$TSLIB_ROOT/lib:$LD_LIBRARY_PATH

export QTDIR=/home/root/ui/qt
export QT_QPA_FONTDIR=$QTDIR/lib/fonts 
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins/ 
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH 
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0
# qt5 without tslib
export QWS_MOUSE_PROTO=/dev/input/event0
# qt with tslib
export QWS_MOUSE_PROTO=tslib:/dev/input/event0 
# or (qt with tslib)
export QT_QPA_GENERIC_PLUGINS=tslib

参考

  • https://blog.csdn.net/Zhu_Zhu_2009/article/details/89090983
  • https://blog.csdn.net/qq_41399894/article/details/99636395
  • https://blog.csdn.net/flfihpv259/article/details/89225996
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值