summaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorSimon South <simon@simonsouth.net>2023-01-28 07:59:37 -0500
committerLudovic Courtès <ludo@gnu.org>2023-03-04 17:29:46 +0100
commitbe41d82d195f2fe2417f46041488b7e09dfc86c4 (patch)
treed56b314f667f163d283af11f27b1421c823fa85e /gnu/packages
parent6febc26827ecf29e301358a2b6e9dd6759a5380a (diff)
gnu: p7zip: Fix build with GCC 11.
* 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. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/compression.scm1
-rw-r--r--gnu/packages/patches/p7zip-fix-build-with-gcc-11.patch49
2 files changed, 50 insertions, 0 deletions
diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index 0e7c300fc9..0365b37fa4 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -1339,6 +1339,7 @@ for most inputs, but the resulting compressed files are anywhere from 20% to
"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