交叉编译QT

准备工作

交叉编译工具链

交叉编译环境构建-CSDN博客

我的环境编译工具链所在位置:/home/user/crosstool/crosstool-ng/build/arm/toolschain/bin

准备源码包

Qt5.14.2: Index of /archive/qt

开始干活

解压Qt源码

xz -d qt-everywhere-src-5.14.2.tar.xz

tar xvf qt-everywhere-src-5.14.2.tar

进入源码目录

cd qt-everywhere-src-5.14.2/

进入源码目录创建定制平台工具链

cd /home/user/crosstool/qt-everywhere-src-5.14.2/qtbase/mkspecs/

cp -rf linux-arm-gnueabi-g++ linux-arm-gnueabihs-g++

修改制平台工具链配置

cd /home/user/crosstool/qt-everywhere-src-5.14.2/qtbase/mkspecs/linux-arm-gnueabihs-g++

vi qmake.conf

修改后的内容如下

注意:所有编译器用我们自定义的编译器,如:QMAKE_CC                = /home/user/crosstool/crosstool-ng/build/arm/toolschain/bin/arm-unknown-linux-gnueabi-gcc

#
# 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)

# modifications to g++.conf
QMAKE_CC                = /home/user/crosstool/crosstool-ng/build/arm/toolschain/bin/arm-unknown-linux-gnueabi-gcc
QMAKE_CXX               = /home/user/crosstool/crosstool-ng/build/arm/toolschain/bin/arm-unknown-linux-gnueabi-g++
QMAKE_LINK              = /home/user/crosstool/crosstool-ng/build/arm/toolschain/bin/arm-unknown-linux-gnueabi-g++
QMAKE_LINK_SHLIB        = /home/user/crosstool/crosstool-ng/build/arm/toolschain/bin/arm-unknown-linux-gnueabi-g++

# modifications to linux.conf
QMAKE_AR                = /home/user/crosstool/crosstool-ng/build/arm/toolschain/bin/arm-unknown-linux-gnueabi-ar cqs
QMAKE_OBJCOPY           = /home/user/crosstool/crosstool-ng/build/arm/toolschain/bin/arm-unknown-linux-gnueabi-objcopy
QMAKE_NM                = /home/user/crosstool/crosstool-ng/build/arm/toolschain/bin/arm-unknown-linux-gnueabi-nm -P
QMAKE_STRIP             = /home/user/crosstool/crosstool-ng/build/arm/toolschain/bin/arm-unknown-linux-gnueabi-strip
load(qt_config)

创建编译目录

mkdir build-arm

创建编译脚本

vi autobuild.sh

增加如下内容

注意:xplatform 指定到我们创建的平台环境----xplatform linux-arm-gnueabihs-g++

#!/bin/bash

../configure \
-prefix /home/user/crosstool/qt-everywhere-src-5.14.2/build_arm/install \
-opensource \
-confirm-license \
-release \
-xplatform linux-arm-gnueabihs-g++ \
-make libs \
-nomake examples \
-nomake tools \
-nomake tests \
-no-openssl \
-no-opengl \
-skip qt3d \
-skip qtactiveqt \
-skip qtandroidextras \
-skip qtcharts \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtdeclarative \
-skip qtdoc \
-skip qtgamepad \
-skip qtgraphicaleffects \
-skip qtimageformats \
-skip qtlocation \
-skip qtlottie \
-skip qtmacextras \
-skip qtmultimedia \
-skip qtnetworkauth \
-skip qtpurchasing \
-skip qtquick3d \
-skip qtquickcontrols \
-skip qtquickcontrols2 \
-skip qtquicktimeline \
-skip qtremoteobjects \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtserialbus \
-skip qtserialport \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qttranslations \
-skip qtvirtualkeyboard \
-skip qtwayland \
-skip qtwebchannel \
-skip qtwebglplugin \
-skip qtwebsockets \
-skip qtwebview \
-skip qtwinextras \
-skip qtx11extras \
-skip qtxmlpatterns \

开始编译&安装

make

make install

查看编译结果

碰到的问题

问题1

qfloat16.h:295:7: error: ‘numeric_limits’ is not a class template

解决办法:添加 #include <limits>

问题2

qbytearraymatcher.h:103:38: error: ‘numeric_limits’ is not a member of ‘std’

解决办法:添加 #include <limits>

问题3:

其他碰到的都是以上的问题,

解决办法:添加 #include <limits>


我公司承接各类技术服务,主要聚焦于:stm32、单片机、嵌入式、QT应用开发、Web+Python+Django应用开发。欢迎合作。

  • 59
    点赞
  • 32
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

汉森教育

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值