当前位置:   article > 正文

linux交叉编译Qt_linux qt 交叉编译

linux qt 交叉编译

软件版本

交叉编译工具链:gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz
Qt版本:qt-everywhere-src-5.12.9.tar.xz
Ubuntu版本:ubuntu-22.04.2-desktop-amd64.iso

解压目录

/home/qsqya/compile/qt5.12.9/qt-everywhere-src-5.12.9
/opt/arm-none-linux-gnueabihf-9.2

环境配置

  1. 打开命令行窗口,配置环境变量(临时的)
export PATH=/opt/arm-none-linux-gnueabihf-9.2/bin:$PATH
  • 1
  1. 修改配置文件
    /home/qsqya/compile/qt5.12.9/qt-everywhere-src-5.12.9/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf
    替换以下内容
:%s#arm-linux-gnueabi#arm-none-linux-gnueabihf#g
  • 1
  1. 编写编译脚本
    /home/qsqya/compile/qt5.12.9/compile.sh
#!/bin/sh

cd ./qt-everywhere-src-5.12.9

./configure -prefix /home/qsqya/compile/qt5.12.9/build \
-opensource \
-release \
-confirm-license \
-xplatform linux-arm-gnueabi-g++ \
-shared \
-nomake examples \
-nomake tests \
-no-opengl
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

路径自行修改
4. 执行脚本

./compile.sh
make -j 4         ##编译
make install      ##安装
  • 1
  • 2
  • 3

问题

  • 报错信息 (5.9.9)
3:38: error: ‘numeric_limits’ is not a member of ‘std’
  103 |         const auto uchar_max = (std::numeric_limits<uchar>::max)();
  • 1
  • 2

解决办法:

qtbase/src/corelib/tools/qbytearraymatcher.h
#include <QtCore/qbytearray.h>
+#include <limits>

  • 1
  • 2
  • 3
  • 4
  • 报错信息
/home/qsqya/compile/qt5.12.9/qt-everywhere-src-5.12.9/qtbase/include/QtCore/../../src/corelib/global/qendian.h:331:35: error: ‘numeric_limits’ is not a member of ‘std’
  331 |     { return QSpecialInteger(std::numeric_limits<T>::max()); }
  • 1
  • 2

解决办法

#include <QtCore/qfloat16.h>
#include <QtCore/qglobal.h>
+#include <limits>
  • 1
  • 2
  • 3
  • 报错信息
/home/qsqya/compile/qt5.12.9/qt-everywhere-src-5.12.9/qtbase/src/corelib/tools/qbytearraymatcher.h:103:38: error: ‘numeric_limits’ is not a member of ‘std’
  103 |         const auto uchar_max = (std::numeric_limits<uchar>::max)();

  • 1
  • 2
  • 3

解决办法

#include <QtCore/qbytearray.h>
+#include <limits>
  • 1
  • 2
  • 报错信息,make阶段报错
/home/qsqya/compile/qt5.12.9/qt-everywhere-src-5.12.9/qtbase/src/corelib/kernel
  • 1

解决办法

#include <QtCore/qobject.h>
#ifndef QT_BOOTSTRAPPED
#include <QtCore/qbytearraylist.h>
#endif
+#include <limits>
  • 1
  • 2
  • 3
  • 4
  • 5
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/283005
推荐阅读
相关标签
  

闽ICP备14008679号