qmake.conf
#
# qmake configuration for building with arm-linux-gnueabihf-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS += -O2 -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard
QMAKE_CXXFLAGS += -O2 -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# 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)
configure命令(全量编译,可以视情况裁剪):
./configure \
-prefix /disk/Data/Embed/IMX6ULL_ATK/qt/qt_bin \
-opensource \
-confirm-license \
-release \
-strip \
-shared \
--pkg-config \
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-c++std c++11 \
--rpath=no \
-pch \
-make libs \
-make examples \
-nomake tools -nomake tests \
-gui \
-widgets \
-dbus-runtime \
--glib=no \
--iconv=no \
--pcre=qt \
--zlib=qt \
-no-openssl \
--freetype=qt \
--harfbuzz=qt \
-no-opengl \
-linuxfb \
--xcb=no \
-tslib \
--libpng=qt \
--libjpeg=qt \
--sqlite=qt \
-plugin-sql-sqlite \
-I/disk/Data/Embed/IMX6ULL_ATK/tslib/tslib_bin/include:/usr/include/c++/11.2.0 \
-L/disk/Data/Embed/IMX6ULL_ATK/tslib/tslib_bin/lib \
-recheck-all
代码修改,修改后才能正常编译:
diff -Naur qt5.15.2/qtbase/src/corelib/global/qendian.h qt-everywhere-src-5.15.2/qtbase/src/corelib/global/qendian.h
--- qt5.15.2/qtbase/src/corelib/global/qendian.h 2020-10-27 16:02:11.000000000 +0800
+++ qt-everywhere-src-5.15.2/qtbase/src/corelib/global/qendian.h 2022-03-12 17:30:02.189500917 +0800
@@ -44,6 +44,8 @@
#include <QtCore/qfloat16.h>
#include <QtCore/qglobal.h>
+#include <limits>
+
// include stdlib.h and hope that it defines __GLIBC__ for glibc-based systems
#include <stdlib.h>
#include <string.h>
diff -Naur qt5.15.2/qtbase/src/corelib/global/qfloat16.h qt-everywhere-src-5.15.2/qtbase/src/corelib/global/qfloat16.h
--- qt5.15.2/qtbase/src/corelib/global/qfloat16.h 2020-10-27 16:02:11.000000000 +0800
+++ qt-everywhere-src-5.15.2/qtbase/src/corelib/global/qfloat16.h 2022-03-12 17:30:22.206756327 +0800
@@ -44,6 +44,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qmetatype.h>
#include <string.h>
+#include <limits>
diff -Naur qt5.15.2/qtbase/src/corelib/text/qbytearray.h qt-everywhere-src-5.15.2/qtbase/src/corelib/text/qbytearray.h
--- qt5.15.2/qtbase/src/corelib/text/qbytearray.h 2020-10-27 16:02:11.000000000 +0800
+++ qt-everywhere-src-5.15.2/qtbase/src/corelib/text/qbytearray.h 2022-03-12 17:31:26.788538547 +0800
@@ -51,6 +51,7 @@
#include <string>
#include <iterator>
+#include <limits>
#ifdef truncate
#error qbytearray.h must be included before any header file that defines truncate
diff -Naur qt5.15.2/qtbase/src/corelib/text/qbytearraymatcher.h qt-everywhere-src-5.15.2/qtbase/src/corelib/text/qbytearraymatcher.h
--- qt5.15.2/qtbase/src/corelib/text/qbytearraymatcher.h 2020-10-27 16:02:11.000000000 +0800
+++ qt-everywhere-src-5.15.2/qtbase/src/corelib/text/qbytearraymatcher.h 2022-03-12 18:09:13.424697019 +0800
@@ -41,6 +41,7 @@
#define QBYTEARRAYMATCHER_H
#include <QtCore/qbytearray.h>
+#include <limits>
QT_BEGIN_NAMESPACE
diff -Naur qt5.15.2/qtbase/src/corelib/time/qtimezoneprivate_p.h qt-everywhere-src-5.15.2/qtbase/src/corelib/time/qtimezoneprivate_p.h
--- qt5.15.2/qtbase/src/corelib/time/qtimezoneprivate_p.h 2020-10-27 16:02:11.000000000 +0800
+++ qt-everywhere-src-5.15.2/qtbase/src/corelib/time/qtimezoneprivate_p.h 2022-03-12 18:10:23.025485164 +0800
@@ -56,6 +56,8 @@
#include "private/qlocale_p.h"
#include "qvector.h"
+#include <limits>
+
#if QT_CONFIG(icu)
#include <unicode/ucal.h>
#endif