GNU bug report logs - #61119
[PATCH core-updates 0/1] gnu: p7zip: Fix build with GCC 11.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Simon South <simon@HIDDEN>; Keywords: patch; dated Sat, 28 Jan 2023 12:58:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 61119 <at> debbugs.gnu.org:


Received: (at 61119) by debbugs.gnu.org; 28 Jan 2023 12:59:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 28 07:59:47 2023
Received: from localhost ([127.0.0.1]:39843 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pLko7-0004Et-9U
	for submit <at> debbugs.gnu.org; Sat, 28 Jan 2023 07:59:47 -0500
Received: from mailout.easymail.ca ([64.68.200.34]:35622)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <simon@HIDDEN>) id 1pLko5-0004Ed-5q
 for 61119 <at> debbugs.gnu.org; Sat, 28 Jan 2023 07:59:46 -0500
Received: from localhost (localhost [127.0.0.1])
 by mailout.easymail.ca (Postfix) with ESMTP id 0246C6813E
 for <61119 <at> debbugs.gnu.org>; Sat, 28 Jan 2023 12:59:40 +0000 (UTC)
X-Virus-Scanned: Debian amavisd-new at emo07-pco.easydns.vpn
Received: from mailout.easymail.ca ([127.0.0.1])
 by localhost (emo07-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id OAMMm2lyW9L7 for <61119 <at> debbugs.gnu.org>;
 Sat, 28 Jan 2023 12:59:39 +0000 (UTC)
Received: from localhost.localdomain (23-233-96-72.cpe.pppoe.ca [23.233.96.72])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mailout.easymail.ca (Postfix) with ESMTPSA id 98EF3680FB
 for <61119 <at> debbugs.gnu.org>; Sat, 28 Jan 2023 12:59:39 +0000 (UTC)
From: Simon South <simon@HIDDEN>
To: 61119 <at> debbugs.gnu.org
Subject: [PATCH core-updates 1/1] gnu: p7zip: Fix build with GCC 11.
Date: Sat, 28 Jan 2023 07:59:37 -0500
Message-Id: <02f866785355e32d9f69f81407b1531cc3d69321.1674909616.git.simon@HIDDEN>
X-Mailer: git-send-email 2.39.1
In-Reply-To: <cover.1674909616.git.simon@HIDDEN>
References: <cover.1674909616.git.simon@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 61119
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

* gnu/packages/patches/p7zip-fix-build-with-gcc-11.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/compression.scm (p7zip)[source]: Apply it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/compression.scm                  |  1 +
 .../patches/p7zip-fix-build-with-gcc-11.patch | 49 +++++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 100644 gnu/packages/patches/p7zip-fix-build-with-gcc-11.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 8821c3fd8b..3dbad5b439 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1596,6 +1596,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/owncloud-disable-updatecheck.patch	\
   %D%/packages/patches/p7zip-CVE-2016-9296.patch		\
   %D%/packages/patches/p7zip-CVE-2017-17969.patch		\
+  %D%/packages/patches/p7zip-fix-build-with-gcc-11.patch	\
   %D%/packages/patches/p7zip-remove-unused-code.patch		\
   %D%/packages/patches/pam-krb5-CVE-2020-10595.patch		\
   %D%/packages/patches/pango-skip-libthai-test.patch		\
diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index e1f47d1e3e..a555d2d319 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -1312,6 +1312,7 @@ (define-public p7zip
                      "switch(static_cast<HRESULT>(errorCode)) {"))))
               (patches (search-patches "p7zip-CVE-2016-9296.patch"
                                        "p7zip-CVE-2017-17969.patch"
+                                       "p7zip-fix-build-with-gcc-11.patch"
                                        "p7zip-remove-unused-code.patch"))))
     (build-system gnu-build-system)
     (arguments
diff --git a/gnu/packages/patches/p7zip-fix-build-with-gcc-11.patch b/gnu/packages/patches/p7zip-fix-build-with-gcc-11.patch
new file mode 100644
index 0000000000..20a40488d8
--- /dev/null
+++ b/gnu/packages/patches/p7zip-fix-build-with-gcc-11.patch
@@ -0,0 +1,49 @@
+Building p7zip with GCC 11 or newer normally fails with error messages like
+
+  ../../../../CPP/7zip/Archive/Wim/WimHandler.cpp:308:11: error: use of an
+  operand of type ‘bool’ in ‘operator++’ is forbidden in C++17
+    308 |           numMethods++;
+        |           ^~~~~~~~~~
+
+This patch causes GCC to interpret the code using the GNU dialect of the C++14
+standard, as GCC 10 did by default, and reduces these errors to warnings.
+
+diff --git a/makefile.linux_amd64_asm b/makefile.linux_amd64_asm
+index 075c6a8..b7d73ee 100644
+--- a/makefile.linux_amd64_asm
++++ b/makefile.linux_amd64_asm
+@@ -11,6 +11,8 @@ ALLFLAGS=-m64 ${OPTFLAGS} -pipe \
+ 	-D_7ZIP_ASM \
+ 	$(LOCAL_FLAGS)
+ 
++ALLFLAGS_CPP=-std=gnu++14
++
+ CXX=g++
+ CC=gcc
+ CC_SHARED=-fPIC
+diff --git a/makefile.linux_any_cpu_gcc_4.X b/makefile.linux_any_cpu_gcc_4.X
+index be093b5..c0f3120 100644
+--- a/makefile.linux_any_cpu_gcc_4.X
++++ b/makefile.linux_any_cpu_gcc_4.X
+@@ -10,7 +10,7 @@ ALLFLAGS=${OPTFLAGS} -pipe \
+ 	-D_7ZIP_LARGE_PAGES \
+ 	$(LOCAL_FLAGS)
+ 
+-ALLFLAGS_CPP=-DENV_HAVE_GCCVISIBILITYPATCH -fvisibility=hidden -fvisibility-inlines-hidden
++ALLFLAGS_CPP=-DENV_HAVE_GCCVISIBILITYPATCH -std=gnu++14 -fvisibility=hidden -fvisibility-inlines-hidden
+ 
+ CXX=g++
+ CC=gcc
+diff --git a/makefile.linux_x86_asm_gcc_4.X b/makefile.linux_x86_asm_gcc_4.X
+index 1ac339b..6e736d9 100644
+--- a/makefile.linux_x86_asm_gcc_4.X
++++ b/makefile.linux_x86_asm_gcc_4.X
+@@ -12,7 +12,7 @@ ALLFLAGS=${OPTFLAGS} -pipe -m32 \
+ 	-D_7ZIP_ASM \
+ 	$(LOCAL_FLAGS)
+ 
+-ALLFLAGS_CPP=-DENV_HAVE_GCCVISIBILITYPATCH -fvisibility=hidden -fvisibility-inlines-hidden
++ALLFLAGS_CPP=-DENV_HAVE_GCCVISIBILITYPATCH -std=gnu++14 -fvisibility=hidden -fvisibility-inlines-hidden
+ 
+ CXX=g++
+ CC=gcc
-- 
2.39.1





Information forwarded to guix-patches@HIDDEN:
bug#61119; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 28 Jan 2023 12:57:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 28 07:57:50 2023
Received: from localhost ([127.0.0.1]:39836 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pLkmD-0004BW-MZ
	for submit <at> debbugs.gnu.org; Sat, 28 Jan 2023 07:57:50 -0500
Received: from lists.gnu.org ([209.51.188.17]:35174)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <simon@HIDDEN>) id 1pLkmB-0004BH-CE
 for submit <at> debbugs.gnu.org; Sat, 28 Jan 2023 07:57:48 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <simon@HIDDEN>)
 id 1pLkmB-0003TH-1r
 for guix-patches@HIDDEN; Sat, 28 Jan 2023 07:57:47 -0500
Received: from mailout.easymail.ca ([64.68.200.34])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <simon@HIDDEN>)
 id 1pLkm9-0004pn-1i
 for guix-patches@HIDDEN; Sat, 28 Jan 2023 07:57:46 -0500
Received: from localhost (localhost [127.0.0.1])
 by mailout.easymail.ca (Postfix) with ESMTP id 37BF667B2F
 for <guix-patches@HIDDEN>; Sat, 28 Jan 2023 12:57:40 +0000 (UTC)
X-Virus-Scanned: Debian amavisd-new at emo09-pco.easydns.vpn
Received: from mailout.easymail.ca ([127.0.0.1])
 by localhost (emo09-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id eB5sKCguarMj for <guix-patches@HIDDEN>;
 Sat, 28 Jan 2023 12:57:40 +0000 (UTC)
Received: from localhost.localdomain (23-233-96-72.cpe.pppoe.ca [23.233.96.72])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mailout.easymail.ca (Postfix) with ESMTPSA id E6F796722C
 for <guix-patches@HIDDEN>; Sat, 28 Jan 2023 12:57:39 +0000 (UTC)
From: Simon South <simon@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH core-updates 0/1] gnu: p7zip: Fix build with GCC 11.
Date: Sat, 28 Jan 2023 07:57:37 -0500
Message-Id: <cover.1674909616.git.simon@HIDDEN>
X-Mailer: git-send-email 2.39.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=64.68.200.34; envelope-from=simon@HIDDEN;
 helo=mailout.easymail.ca
X-Spam_score_int: -41
X-Spam_score: -4.2
X-Spam_bar: ----
X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

On core-updates, p7zip is failing to build with error messages like

  ../../../../CPP/7zip/Archive/Wim/WimHandler.cpp:308:11: error: use of an
  operand of type ‘bool’ in ‘operator++’ is forbidden in C++17
    308 |           numMethods++;
        |           ^~~~~~~~~~

This follows from the move to GCC 11 and its use by default of the GNU dialect
of the C++17 standard for interpreting C++ code.  (Note p7zip is essentially
abandoned and its code is aging.)

The patch to follow causes GCC to use the GNU dialect of the C++14 standard
instead, as GCC 10 did by default, reducing the error messages to warnings and
allowing the build to complete.

I've tested this on x86-64 and AArch64 and everything seems fine.

--
Simon South
simon@HIDDEN


Simon South (1):
  gnu: p7zip: Fix build with GCC 11.

 gnu/local.mk                                  |  1 +
 gnu/packages/compression.scm                  |  1 +
 .../patches/p7zip-fix-build-with-gcc-11.patch | 49 +++++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 100644 gnu/packages/patches/p7zip-fix-build-with-gcc-11.patch


base-commit: 770d379d7b60590bfdcb749287cb6713dee093ce
prerequisite-patch-id: 418e6f2f834e0f77d4da64e48bf654d610fbfe80
-- 
2.39.1





Acknowledgement sent to Simon South <simon@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#61119; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 28 Jan 2023 13:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.