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

Previous Next

Package: guix-patches;

Reported by: Simon South <simon <at> simonsouth.net>

Date: Sat, 28 Jan 2023 12:58:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61119 in the body.
You can then email your comments to 61119 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#61119; Package guix-patches. (Sat, 28 Jan 2023 12:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Simon South <simon <at> simonsouth.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 28 Jan 2023 12:58:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: guix-patches <at> gnu.org
Subject: [PATCH core-updates 0/1] gnu: p7zip: Fix build with GCC 11.
Date: Sat, 28 Jan 2023 07:57:37 -0500
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 <at> simonsouth.net


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





Information forwarded to guix-patches <at> gnu.org:
bug#61119; Package guix-patches. (Sat, 28 Jan 2023 13:00:02 GMT) Full text and rfc822 format available.

Message #8 received at 61119 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
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
* 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





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sat, 04 Mar 2023 16:31:02 GMT) Full text and rfc822 format available.

Notification sent to Simon South <simon <at> simonsouth.net>:
bug acknowledged by developer. (Sat, 04 Mar 2023 16:31:02 GMT) Full text and rfc822 format available.

Message #13 received at 61119-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Simon South <simon <at> simonsouth.net>
Cc: 61119-done <at> debbugs.gnu.org
Subject: Re: bug#61119: [PATCH core-updates 0/1] gnu: p7zip: Fix build with
 GCC 11.
Date: Sat, 04 Mar 2023 17:30:06 +0100
Hi,

Simon South <simon <at> simonsouth.net> skribis:

> * 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.

Applied, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 02 Apr 2023 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 24 days ago.

Previous Next


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