[PATCH] ceph: fix gcc-12 compile failure


Chen Qi
 

Add two patches to fix gcc-12 compile failure.

Signed-off-by: Chen Qi <Qi.Chen@...>
---
...ssing-header-file-due-to-gcc-upgrade.patch | 30 +++++++++++++
...S-due-to-dout-need_dynamic-on-GCC-12.patch | 42 +++++++++++++++++++
recipes-extended/ceph/ceph_15.2.15.bb | 2 +
3 files changed, 74 insertions(+)
create mode 100644 recipes-extended/ceph/ceph/0001-buffer.h-add-missing-header-file-due-to-gcc-upgrade.patch
create mode 100644 recipes-extended/ceph/ceph/0002-common-fix-FTBFS-due-to-dout-need_dynamic-on-GCC-12.patch

diff --git a/recipes-extended/ceph/ceph/0001-buffer.h-add-missing-header-file-due-to-gcc-upgrade.patch b/recipes-extended/ceph/ceph/0001-buffer.h-add-missing-header-file-due-to-gcc-upgrade.patch
new file mode 100644
index 0000000..70d3eb9
--- /dev/null
+++ b/recipes-extended/ceph/ceph/0001-buffer.h-add-missing-header-file-due-to-gcc-upgrade.patch
@@ -0,0 +1,30 @@
+From 496465d9238109a93612e28682273e5bf576823b Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@...>
+Date: Sun, 22 May 2022 19:40:59 -0700
+Subject: [PATCH 1/2] buffer.h: add missing header file due to gcc upgrade
+
+The header file <memory> have been changed to be no longer included by other
+heades, thus requiring explicit include. See https://gcc.gnu.org/gcc-12/porting_to.html
+
+Upstream-Status: Pending
+
+Signed-off-by: Chen Qi <Qi.Chen@...>
+---
+ src/include/buffer.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/include/buffer.h b/src/include/buffer.h
+index 5c8b427d..88845ee6 100644
+--- a/src/include/buffer.h
++++ b/src/include/buffer.h
+@@ -43,6 +43,7 @@
+ #include <list>
+ #include <vector>
+ #include <string>
++#include <memory>
+ #if __cplusplus >= 201703L
+ #include <string_view>
+ #endif // __cplusplus >= 201703L
+--
+2.36.0
+
diff --git a/recipes-extended/ceph/ceph/0002-common-fix-FTBFS-due-to-dout-need_dynamic-on-GCC-12.patch b/recipes-extended/ceph/ceph/0002-common-fix-FTBFS-due-to-dout-need_dynamic-on-GCC-12.patch
new file mode 100644
index 0000000..d119bf1
--- /dev/null
+++ b/recipes-extended/ceph/ceph/0002-common-fix-FTBFS-due-to-dout-need_dynamic-on-GCC-12.patch
@@ -0,0 +1,42 @@
+From 841806de212226921eeaeb3eea054bda8ccce616 Mon Sep 17 00:00:00 2001
+From: Radoslaw Zarzynski <rzarzyns@...>
+Date: Wed, 19 Jan 2022 15:24:11 +0000
+Subject: [PATCH 2/2] common: fix FTBFS due to dout & need_dynamic on GCC-12
+
+For details see:
+https://gist.github.com/rzarzynski/d6d2df6888923bef6a3e764f4856853f.
+
+Special thanks to Kaleb Keithley who reported the issue
+and tested the fix!
+
+Fixes: https://tracker.ceph.com/issues/53896
+Signed-off-by: Radoslaw Zarzynski <rzarzyns@...>
+
+Upstream-Status: Backport [963d756ded40f5adf2efef53893c917bec1845c1]
+Signed-off-by: Chen Qi <Qi.Chen@...>
+---
+ src/common/dout.h | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/common/dout.h b/src/common/dout.h
+index c7c08182..42f49915 100644
+--- a/src/common/dout.h
++++ b/src/common/dout.h
+@@ -99,11 +99,12 @@ namespace ceph::dout {
+ template<typename T>
+ struct dynamic_marker_t {
+ T value;
+- operator T() const { return value; }
++ // constexpr ctor isn't needed as it's an aggregate type
++ constexpr operator T() const { return value; }
+ };
+
+ template<typename T>
+-dynamic_marker_t<T> need_dynamic(T&& t) {
++constexpr dynamic_marker_t<T> need_dynamic(T&& t) {
+ return dynamic_marker_t<T>{ std::forward<T>(t) };
+ }
+
+--
+2.36.0
+
diff --git a/recipes-extended/ceph/ceph_15.2.15.bb b/recipes-extended/ceph/ceph_15.2.15.bb
index 17dbcf3..0fb32b2 100644
--- a/recipes-extended/ceph/ceph_15.2.15.bb
+++ b/recipes-extended/ceph/ceph_15.2.15.bb
@@ -14,6 +14,8 @@ SRC_URI = "http://download.ceph.com/tarballs/ceph-${PV}.tar.gz \
file://ceph.conf \
file://0001-cmake-add-support-for-python3.10.patch \
file://0001-SnappyCompressor.h-fix-snappy-compiler-error.patch \
+ file://0001-buffer.h-add-missing-header-file-due-to-gcc-upgrade.patch \
+ file://0002-common-fix-FTBFS-due-to-dout-need_dynamic-on-GCC-12.patch \
"

SRC_URI[sha256sum] = "5dccdaff2ebe18d435b32bfc06f8b5f474bf6ac0432a6a07d144b7c56700d0bf"
--
2.36.0


Bruce Ashfield
 

merged.

Bruce

In message: [meta-virtualization][PATCH] ceph: fix gcc-12 compile failure
on 22/05/2022 Chen Qi wrote:

Add two patches to fix gcc-12 compile failure.

Signed-off-by: Chen Qi <Qi.Chen@...>
---
...ssing-header-file-due-to-gcc-upgrade.patch | 30 +++++++++++++
...S-due-to-dout-need_dynamic-on-GCC-12.patch | 42 +++++++++++++++++++
recipes-extended/ceph/ceph_15.2.15.bb | 2 +
3 files changed, 74 insertions(+)
create mode 100644 recipes-extended/ceph/ceph/0001-buffer.h-add-missing-header-file-due-to-gcc-upgrade.patch
create mode 100644 recipes-extended/ceph/ceph/0002-common-fix-FTBFS-due-to-dout-need_dynamic-on-GCC-12.patch

diff --git a/recipes-extended/ceph/ceph/0001-buffer.h-add-missing-header-file-due-to-gcc-upgrade.patch b/recipes-extended/ceph/ceph/0001-buffer.h-add-missing-header-file-due-to-gcc-upgrade.patch
new file mode 100644
index 0000000..70d3eb9
--- /dev/null
+++ b/recipes-extended/ceph/ceph/0001-buffer.h-add-missing-header-file-due-to-gcc-upgrade.patch
@@ -0,0 +1,30 @@
+From 496465d9238109a93612e28682273e5bf576823b Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@...>
+Date: Sun, 22 May 2022 19:40:59 -0700
+Subject: [PATCH 1/2] buffer.h: add missing header file due to gcc upgrade
+
+The header file <memory> have been changed to be no longer included by other
+heades, thus requiring explicit include. See https://gcc.gnu.org/gcc-12/porting_to.html
+
+Upstream-Status: Pending
+
+Signed-off-by: Chen Qi <Qi.Chen@...>
+---
+ src/include/buffer.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/include/buffer.h b/src/include/buffer.h
+index 5c8b427d..88845ee6 100644
+--- a/src/include/buffer.h
++++ b/src/include/buffer.h
+@@ -43,6 +43,7 @@
+ #include <list>
+ #include <vector>
+ #include <string>
++#include <memory>
+ #if __cplusplus >= 201703L
+ #include <string_view>
+ #endif // __cplusplus >= 201703L
+--
+2.36.0
+
diff --git a/recipes-extended/ceph/ceph/0002-common-fix-FTBFS-due-to-dout-need_dynamic-on-GCC-12.patch b/recipes-extended/ceph/ceph/0002-common-fix-FTBFS-due-to-dout-need_dynamic-on-GCC-12.patch
new file mode 100644
index 0000000..d119bf1
--- /dev/null
+++ b/recipes-extended/ceph/ceph/0002-common-fix-FTBFS-due-to-dout-need_dynamic-on-GCC-12.patch
@@ -0,0 +1,42 @@
+From 841806de212226921eeaeb3eea054bda8ccce616 Mon Sep 17 00:00:00 2001
+From: Radoslaw Zarzynski <rzarzyns@...>
+Date: Wed, 19 Jan 2022 15:24:11 +0000
+Subject: [PATCH 2/2] common: fix FTBFS due to dout & need_dynamic on GCC-12
+
+For details see:
+https://gist.github.com/rzarzynski/d6d2df6888923bef6a3e764f4856853f.
+
+Special thanks to Kaleb Keithley who reported the issue
+and tested the fix!
+
+Fixes: https://tracker.ceph.com/issues/53896
+Signed-off-by: Radoslaw Zarzynski <rzarzyns@...>
+
+Upstream-Status: Backport [963d756ded40f5adf2efef53893c917bec1845c1]
+Signed-off-by: Chen Qi <Qi.Chen@...>
+---
+ src/common/dout.h | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/common/dout.h b/src/common/dout.h
+index c7c08182..42f49915 100644
+--- a/src/common/dout.h
++++ b/src/common/dout.h
+@@ -99,11 +99,12 @@ namespace ceph::dout {
+ template<typename T>
+ struct dynamic_marker_t {
+ T value;
+- operator T() const { return value; }
++ // constexpr ctor isn't needed as it's an aggregate type
++ constexpr operator T() const { return value; }
+ };
+
+ template<typename T>
+-dynamic_marker_t<T> need_dynamic(T&& t) {
++constexpr dynamic_marker_t<T> need_dynamic(T&& t) {
+ return dynamic_marker_t<T>{ std::forward<T>(t) };
+ }
+
+--
+2.36.0
+
diff --git a/recipes-extended/ceph/ceph_15.2.15.bb b/recipes-extended/ceph/ceph_15.2.15.bb
index 17dbcf3..0fb32b2 100644
--- a/recipes-extended/ceph/ceph_15.2.15.bb
+++ b/recipes-extended/ceph/ceph_15.2.15.bb
@@ -14,6 +14,8 @@ SRC_URI = "http://download.ceph.com/tarballs/ceph-${PV}.tar.gz \
file://ceph.conf \
file://0001-cmake-add-support-for-python3.10.patch \
file://0001-SnappyCompressor.h-fix-snappy-compiler-error.patch \
+ file://0001-buffer.h-add-missing-header-file-due-to-gcc-upgrade.patch \
+ file://0002-common-fix-FTBFS-due-to-dout-need_dynamic-on-GCC-12.patch \
"

SRC_URI[sha256sum] = "5dccdaff2ebe18d435b32bfc06f8b5f474bf6ac0432a6a07d144b7c56700d0bf"
--
2.36.0