Skip to contentSkip to conversation

opensaf: Fix build with gcc 12

PATCH New Khem Raj 1 participant 2 messages Apr 13, 2022

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 opensaf: Fix build with gcc 12

Use configure logic to disable certain warnings if compiler supports them

---
 .../0001-include-missing-array-header.patch   | 32 +++++++++++++++++++
 ...-configure-Disable-selected-warnings.patch | 32 +++++++++++++++++++
 .../opensaf/opensaf_5.22.01.bb                |  6 ++--
 3 files changed, 68 insertions(+), 2 deletions(-)
 create mode 100644 meta-networking/recipes-daemons/opensaf/opensaf/0001-include-missing-array-header.patch
 create mode 100644 meta-networking/recipes-daemons/opensaf/opensaf/0002-configure-Disable-selected-warnings.patch
meta-networking/recipes-daemons/opensaf/opensaf/0001-include-missing-array-header.patch new file +32 -0
new file mode 100644
index 0000000000..e735d432a7
@@ -0,0 +1,32 @@
+From 6168d43ddd353b92ad8bcd5c49dc68f18caa8a00 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 12 Apr 2022 17:07:49 -0700
+Subject: [PATCH 1/2] include missing <array> header
+
+Fixes
+src/osaf/consensus/key_value.cc:25:30: error: aggregate 'std::array<char, 128> buffer' has incomplete type and cannot be defined
+   25 |   std::array<char, buf_size> buffer;
+      |                              ^~~~~~
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/osaf/consensus/key_value.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/osaf/consensus/key_value.cc b/src/osaf/consensus/key_value.cc
+index 692dd3f..6e16cbf 100644
+--- a/src/osaf/consensus/key_value.cc
++++ b/src/osaf/consensus/key_value.cc
+@@ -18,7 +18,7 @@
+ #include "base/getenv.h"
+ #include "base/logtrace.h"
+ #include "osaf/consensus/consensus.h"
+-
++#include <array>
+ int KeyValue::Execute(const std::string& command, std::string& output) {
+   TRACE_ENTER();
+   constexpr size_t buf_size = 128;
+-- 
+2.35.1
+
meta-networking/recipes-daemons/opensaf/opensaf/0002-configure-Disable-selected-warnings.patch new file +32 -0
new file mode 100644
index 0000000000..8bb659743d
@@ -0,0 +1,32 @@
+From fe654d5340d18f04e4689ba19f843554909a0c00 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 12 Apr 2022 17:16:37 -0700
+Subject: [PATCH 2/2] configure: Disable selected warnings
+
+These warnings are emitted when compiling with gcc 11 and gcc 12
+Do not treat them as errors
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ configure.ac | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index c28d2d9..2846175 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -601,7 +601,9 @@ if test -z "$OSAF_HARDEN_FLAGS"; then
+ fi
+ AC_SUBST(OSAF_HARDEN_FLAGS)
+ 
+-AX_CHECK_COMPILE_FLAG([-Werror=format-overflow],[NOWARNINGS=-Wno-error=format-overflow])
++AX_CHECK_COMPILE_FLAG([-Werror=format-overflow],[NOWARNINGS='-Wno-error=format-overflow'])
++AX_CHECK_COMPILE_FLAG([-Wuse-after-free],[NOWARNINGS+=' -Wno-error=use-after-free'])
++AX_CHECK_COMPILE_FLAG([-Wstringop-truncation],[NOWARNINGS+=' -Wno-error=stringop-truncation'])
+ AC_SUBST(NOWARNINGS)
+ #############################################
+ # List the output Makefiles
+-- 
+2.35.1
+
meta-networking/recipes-daemons/opensaf/opensaf_5.22.01.bb +4 -2
index 8ce324d306..930755d624 100644
@@ -28,6 +28,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/releases/${BPN}-${PV}.tar.gz \
            file://0001-immom_python-convert-to-python3.patch \
            file://0001-Fix-build-with-fno-common.patch \
            file://0001-Use-correct-printf-format-for-__fsblkcnt_t.patch \
+           file://0001-include-missing-array-header.patch \
+           file://0002-configure-Disable-selected-warnings.patch \
            "
 SRC_URI[sha256sum] = "f008d53c83087ce2014c6089bc4ef08e14c1b4091298b943f4ceade1aa6bf61e"
 
@@ -48,8 +50,8 @@ PACKAGECONFIG[plm] = "--enable-ais-plm,--disable-ais-plm,libvirt openhpi"
 
 PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd', '', d)}"
 
-CPPFLAGS += "-Wno-error=stringop-overflow= -Wno-error=stringop-truncation"
-CXXFLAGS += "-Wno-error=stringop-overflow= -Wno-error=stringop-truncation -Wno-error=format-truncation="
+CPPFLAGS += "-Wno-error"
+CXXFLAGS += "-Wno-error"
 LDFLAGS += "-Wl,--as-needed -latomic -Wl,--no-as-needed"
 
 do_install:append() {
Signature · 1 line
2.35.2
author
#1 lore raw

PATCH 2/2 boost-sml: Disable examples

They fail to build with gcc 12

---
 meta-oe/recipes-support/boost-sml/boost-sml_git.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-oe/recipes-support/boost-sml/boost-sml_git.bb +2 -1
index 97c04899bf..e22eddb72d 100644
@@ -19,7 +19,8 @@ S = "${WORKDIR}/git"
 inherit cmake
 
 # Building benchmarks takes a lot of time and requires additional headers (euml2.hpp)
-EXTRA_OECMAKE:append = " -DSML_BUILD_BENCHMARKS:bool=OFF"
+# Building examples fail with gcc-12
+EXTRA_OECMAKE:append = " -DSML_BUILD_BENCHMARKS:bool=OFF -DSML_BUILD_EXAMPLES=OFF"
 
 # [boost::ext].XML is a header only C++ library, so the main package will be empty.
 ALLOW_EMPTY:${PN} = "1"
Signature · 1 line
2.35.2