准备工作
交叉编译工具链
我的环境编译工具链所在位置:/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应用开发。欢迎合作。