Subject: [PATCH] gnu: packages: qt: Fix qtbase-5 not building on gcc 11 or later
From: Mája Tomášek <[email-masked]>
To: [email-masked]
Date: Sun, 02 Oct 2022 16:22:33 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

This fixes a bug that makes qtbase-5 unbuildable with gcc 11 and later

The QT issue https://bugreports.qt.io/browse/QTBUG-91909

This patch is based on conversation from
https://github.com/RPCS3/rpcs3/issues/10349

From d7467ebe3169d45a5f9500e2c8a4a992cb108f20 Mon Sep 17 00:00:00 2001
From: Maya Tomasek <[email-masked]>
Date: Sun, 2 Oct 2022 16:12:57 +0200
Subject: [PATCH 1/1] gnu: packages: qt: Fix qtbase-5 not building on gcc >= 11

---
 .../patches/qtbase-remove-template.patch       | 18 ++++++++++++++++++
 gnu/packages/qt.scm                            |  4 +++-
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/qtbase-remove-template.patch

diff --git a/gnu/packages/patches/qtbase-remove-template.patch b/gnu/packages/patches/qtbase-remove-template.patch
new file mode 100644
index 0000000000..5686ebf4db
--- /dev/null
+++ b/gnu/packages/patches/qtbase-remove-template.patch
@@ -0,0 +1,18 @@
+Remove template <void> from ThreadEngineStarter, this causes gcc >= 11 to emit error,
+and not compile the header. See https://bugreports.qt.io/browse/QTBUG-91909
+
+Based on a conversation from https://github.com/RPCS3/rpcs3/issues/10349
+===============================================================
+--- a/src/concurrent/qtconcurrentthreadengine.h
++++ b/src/concurrent/qtconcurrentthreadengine.h
+@@ -247,7 +247,7 @@ template <>
+ class ThreadEngineStarter<void> : public ThreadEngineStarterBase<void>
+ {
+ public:
+-    ThreadEngineStarter<void>(ThreadEngine<void> *_threadEngine)
++    ThreadEngineStarter(ThreadEngine<void> *_threadEngine)
+     :ThreadEngineStarterBase<void>(_threadEngine) {}
+ 
+     void startBlocking()
+-- 
+2.37.3
\ No newline at end of file
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 6e30980505..6d29b6fd09 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -294,7 +294,9 @@ (define-public qtbase-5
               ;; Use TZDIR to avoid depending on package "tzdata".
               (patches (search-patches "qtbase-use-TZDIR.patch"
                                        "qtbase-moc-ignore-gcc-macro.patch"
-                                       "qtbase-absolute-runpath.patch"))
+                                       "qtbase-absolute-runpath.patch"
+                                       ;; fix qtbase-5 not building on gcc >= 11
+                                       "qtbase-remove-template.patch"))
               (modules '((guix build utils)))
               (snippet
                ;; corelib uses bundled harfbuzz, md4, md5, sha3
-- 
2.37.3