Skip to content

Commit

Permalink
fix build on gcc11
Browse files Browse the repository at this point in the history
  • Loading branch information
xyzz committed Jul 15, 2023
1 parent be3bdbb commit 7c88b2e
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 5 deletions.
17 changes: 12 additions & 5 deletions build-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

set -e

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

source ./version.sh
source ./emsdk/emsdk_env.sh

embuilder build zlib bzip2

rm -rf deps
mkdir deps && cd deps

tar xvf ../sources/xz-${XZ_VER}.tar.gz
Expand Down Expand Up @@ -49,7 +52,11 @@ popd
tar xvf ../sources/qt-everywhere-src-${QT_VER}.tar.xz
mv qt-everywhere-src-${QT_VER} qt5
pushd qt5/
patch -p1 < ../../patches/qt.patch
patch -p1 < $SCRIPT_DIR/patches/qt/qt.patch
pushd qtbase
patch -p1 < $SCRIPT_DIR/patches/qt/qtcore-5.15.2-gcc11.patch
patch -p1 < $SCRIPT_DIR/patches/qt/0008-Add-missing-limits-include.patch
popd
./configure -xplatform wasm-emscripten -nomake examples -prefix $PWD/qtbase -feature-thread -opensource -confirm-license
make module-qtbase module-qtdeclarative qtsvg -j$(nproc)
popd
Expand All @@ -68,7 +75,7 @@ popd

tar -xf ../sources/PyQt5_sip-${PYQT5SIP_VER}.tar.gz
pushd PyQt5_sip-${PYQT5SIP_VER}/
patch -p1 < ../../patches/pyqt5sip.patch
patch -p1 < $SCRIPT_DIR/patches/pyqt5sip.patch
mkdir build

for file in apiversions.c voidptr.c threads.c objmap.c descriptors.c array.c qtlib.c int_convertors.c siplib.c; do
Expand All @@ -84,12 +91,12 @@ popd

tar -xf ../sources/PyQt5-${PYQT5_VER}.tar.gz
pushd PyQt5-${PYQT5_VER}/
patch -p1 < ../../patches/pyqt5.patch
patch -p1 < $SCRIPT_DIR/patches/pyqt5.patch
python ./configure.py --qmake ../qt5/qtbase/bin/qmake --static --confirm-license --sip-incdir=../PyQt5_sip-${PYQT5SIP_VER}/

pushd QtCore
sed -i "s+-I../../cpython/Include+-I../../cpython/Include -I../../cpython/builddir/emscripten-browser/+g" Makefile
patch < ../../../patches/pyqt5-qtcore.patch
patch < $SCRIPT_DIR/patches/pyqt5-qtcore.patch
make -j$(nproc)
popd

Expand All @@ -100,7 +107,7 @@ popd

pushd QtWidgets
sed -i "s+-I../../cpython/Include+-I../../cpython/Include -I../../cpython/builddir/emscripten-browser/+g" Makefile
patch < ../../../patches/pyqt5-qtwidgets.patch
patch < $SCRIPT_DIR/patches/pyqt5-qtwidgets.patch
make -j$(nproc)
popd

Expand Down
32 changes: 32 additions & 0 deletions patches/qt/0008-Add-missing-limits-include.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 87a869a8404047240cccaa9f101351aeb9417a26 Mon Sep 17 00:00:00 2001
From: Nicolas Fella <nicolas.fella@kdab.com>
Date: Sun, 20 Jun 2021 17:36:41 +0200
Subject: [PATCH] Add missing limits include

The code uses std::numeric_limits but is lacking the appropriate include

Pick-to: 5.15 6.1 6.2
Change-Id: I41fa5ac4d8c4e06f35b5b1551ef2ad8417df80bd
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>

[Upstream: https://code.qt.io/cgit/qt/qtbase.git/patch/?id=2b2b3155d9f6ba1e4f859741468fbc47db09292b]
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
src/corelib/tools/qoffsetstringarray_p.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/corelib/tools/qoffsetstringarray_p.h b/src/corelib/tools/qoffsetstringarray_p.h
index 4dd9e960..e26a57ff 100644
--- a/src/corelib/tools/qoffsetstringarray_p.h
+++ b/src/corelib/tools/qoffsetstringarray_p.h
@@ -55,6 +55,7 @@

#include <tuple>
#include <array>
+#include <limits>

QT_BEGIN_NAMESPACE

--
2.32.0

File renamed without changes.
38 changes: 38 additions & 0 deletions patches/qt/qtcore-5.15.2-gcc11.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Description: include <limits> to fix some GCC 11 build issues
Origin: upstream, commits:
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=813a928c7c3cf986
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=9c56d4da2ff631a8
Last-Update: 2021-01-26

--- a/src/corelib/global/qendian.h
+++ b/src/corelib/global/qendian.h
@@ -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>
--- a/src/corelib/global/qfloat16.h
+++ b/src/corelib/global/qfloat16.h
@@ -43,6 +43,7 @@

#include <QtCore/qglobal.h>
#include <QtCore/qmetatype.h>
+#include <limits>
#include <string.h>

#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__AVX2__) && !defined(__F16C__)
--- a/src/corelib/text/qbytearraymatcher.h
+++ b/src/corelib/text/qbytearraymatcher.h
@@ -42,6 +42,8 @@

#include <QtCore/qbytearray.h>

+#include <limits>
+
QT_BEGIN_NAMESPACE


0 comments on commit 7c88b2e

Please sign in to comment.