ceph: fix build with gcc-13

* this isn't complete fix as there are still issues from new boost as in:
  https://github.com/boostorg/phoenix/issues/111
  http://errors.yoctoproject.org/Errors/Details/702743/
  TOPDIR/tmp-glibc/work/core2-64-oe-linux/ceph/15.2.15-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/13.1.0/ld: CMakeFiles/common-objs.dir/mon/MonCap.cc.o:/usr/include/boost/preprocessor/iteration/detail/limits/local_256.hpp:43: multiple definition of `boost::phoenix::placeholders::uarg10'; common/CMakeFiles/common-common-objs.dir/ConfUtils.cc.o:/usr/include/boost/preprocessor/iteration/detail/limits/local_256.hpp:43: first defined here

* probably easiest fix for above would be to upgrade to newer ceph, but
  I'm not using it, so couldn't properly test it (I was just looking
  at bitbake world failures in mickledore

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Martin Jansa 2023-05-03 08:38:57 +02:00 committed by Bruce Ashfield
parent 9b0ade8f4f
commit cfa4ce1af7
4 changed files with 175 additions and 0 deletions

View File

@ -0,0 +1,41 @@
From 59e6b44f7ed4020a860e347322acfdacc6e4560b Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Fri, 28 Oct 2022 16:47:38 +0100
Subject: [PATCH] common: fix build with GCC 13 (missing <cstdint> include)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Needed for uint8_t. Only worked by chance before (see
https://www.gnu.org/software/gcc/gcc-13/porting_to.html).
```
FAILED: src/CMakeFiles/common-objs.dir/mds/FSMapUser.cc.o
/usr/bin/x86_64-pc-linux-gnu-g++ -DBOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION -DHAVE_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -D__CEPH__ -D__STDC_FORMAT_MACROS -D__linux__ -I/var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5_build/src/include -I/var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src -isystem /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5_build/include -isystem /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/xxHash -isystem /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/rapidjson/include -O2 -march=native -pipe -fPIC -U_FORTIFY_SOURCE -Wall -fno-strict-aliasing -fsigned-char -Wtype-limits -Wignored-qualifiers -Wpointer-arith -Werror=format-security -Winit-self -Wno-unknown-pragmas -Wnon-virtual-dtor -Wno-ignored-qualifiers -ftemplate-depth-1024 -Wpessimizing-move -Wredundant-move -Wstrict-null-sentinel -Woverloaded-virtual -fno-new-ttp-matching -fstack-protector-strong -fdiagnostics-color=auto -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -std=c++17 -MD -MT src/CMakeFiles/common-objs.dir/mds/FSMapUser.cc.o -MF src/CMakeFiles/common-objs.dir/mds/FSMapUser.cc.o.d -o src/CMakeFiles/common-objs.dir/mds/FSMapUser.cc.o -c /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/mds/FSMapUser.cc
In file included from /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/log/SubsystemMap.h:12,
from /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/common/config.h:23,
from /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/mds/mdstypes.h:13,
from /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/mds/FSMapUser.h:21,
from /var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/mds/FSMapUser.cc:1:
/var/tmp/portage/sys-cluster/ceph-17.2.5/work/ceph-17.2.5/src/common/subsys_types.h:56:23: error: uint8_t in namespace std does not name a type; did you mean wint_t?
```
Bug: https://bugs.gentoo.org/878531
Signed-off-by: Sam James <sam@gentoo.org>
Upstream-Status: Backport [https://github.com/ceph/ceph/commit/74794f9d6f5c6671438085bdba730b504901a7c0]
---
src/common/subsys_types.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/common/subsys_types.h b/src/common/subsys_types.h
index 52171809..bd7cc439 100644
--- a/src/common/subsys_types.h
+++ b/src/common/subsys_types.h
@@ -17,6 +17,7 @@
#include <algorithm>
#include <array>
+#include <cstdint>
enum ceph_subsys_id_t {
ceph_subsys_, // default

View File

@ -0,0 +1,101 @@
From cca3144aca7f7c19772065421f9b02205a84e0b8 Mon Sep 17 00:00:00 2001
From: Casey Bodley <cbodley@redhat.com>
Date: Tue, 15 Feb 2022 18:27:10 -0500
Subject: [PATCH] common: replace BitVector::NoInitAllocator with wrapper
struct
in c++20, the deprecated `struct std::allocator<T>::rebind` template was
removed, so `BitVector` no longer compiles. without a `rebind` to
inherit, `std::allocator_traits<NoInitAllocator>::rebind_alloc<U>` was
looking for `NoInitAllocator<U>`, but it isn't a template class
further investigation found that in c++17, `vector<__u32, NoInitAllocator>`
was rebinding this `NoInitAllocator` to `std::allocator<__u32>` and
preventing the no-init optimization from taking effect
instead of messing with the allocator to avoid zero-initialization, wrap
each __u32 in a struct whose constructor does not initialize the value
Fixes: https://tracker.ceph.com/issues/54279
Signed-off-by: Casey Bodley <cbodley@redhat.com>
---
Fixes:
http://errors.yoctoproject.org/Errors/Details/701862/
Upstream-Status: Backport [https://github.com/ceph/ceph/commit/4f0ad8aab6b21a1fd57a7c1630d298e31b5d9bb6]
src/common/bit_vector.hpp | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/src/common/bit_vector.hpp b/src/common/bit_vector.hpp
index 10ee6c3e..9ce3e8b1 100644
--- a/src/common/bit_vector.hpp
+++ b/src/common/bit_vector.hpp
@@ -223,23 +223,18 @@ public:
static void generate_test_instances(std::list<BitVector *> &o);
private:
- struct NoInitAllocator : public std::allocator<__u32> {
- NoInitAllocator() {}
- NoInitAllocator(const std::allocator<__u32>& alloc)
- : std::allocator<__u32>(alloc) {
- }
-
- template <class U, class... Args>
- void construct(U* p, Args&&... args) const {
- }
- };
-
bufferlist m_data;
uint64_t m_size;
bool m_crc_enabled;
mutable __u32 m_header_crc;
- mutable std::vector<__u32, NoInitAllocator> m_data_crcs;
+
+ // inhibit value-initialization when used in std::vector
+ struct u32_struct {
+ u32_struct() {}
+ __u32 val;
+ };
+ mutable std::vector<u32_struct> m_data_crcs;
void resize(uint64_t elements, bool zero);
@@ -351,7 +346,7 @@ void BitVector<_b>::encode_data(bufferlist& bl, uint64_t data_byte_offset,
bufferlist bit;
bit.substr_of(m_data, data_byte_offset, len);
- m_data_crcs[data_byte_offset / BLOCK_SIZE] = bit.crc32c(0);
+ m_data_crcs[data_byte_offset / BLOCK_SIZE].val = bit.crc32c(0);
bl.claim_append(bit);
data_byte_offset += BLOCK_SIZE;
@@ -385,7 +380,7 @@ void BitVector<_b>::decode_data(bufferlist::const_iterator& it,
bufferlist bit;
bit.append(ptr);
if (m_crc_enabled &&
- m_data_crcs[data_byte_offset / BLOCK_SIZE] != bit.crc32c(0)) {
+ m_data_crcs[data_byte_offset / BLOCK_SIZE].val != bit.crc32c(0)) {
throw buffer::malformed_input("invalid data block CRC");
}
data.append(bit);
@@ -499,7 +494,7 @@ void BitVector<_b>::encode_data_crcs(bufferlist& bl, uint64_t offset,
compute_index(offset + length - 1, &index, &shift);
uint64_t end_crc_index = index / BLOCK_SIZE;
while (crc_index <= end_crc_index) {
- __u32 crc = m_data_crcs[crc_index++];
+ __u32 crc = m_data_crcs[crc_index++].val;
ceph::encode(crc, bl);
}
}
@@ -520,7 +515,7 @@ void BitVector<_b>::decode_data_crcs(bufferlist::const_iterator& it,
while (remaining > 0) {
__u32 crc;
ceph::decode(crc, it);
- m_data_crcs[crc_index++] = crc;
+ m_data_crcs[crc_index++].val = crc;
--remaining;
}
}

View File

@ -0,0 +1,30 @@
From 937231991bd7e2cd578cf8cb6c1bedf611c5faef Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Sat, 29 Apr 2023 13:47:43 +0200
Subject: [PATCH] librdb: fix build with gcc-13
* fixes:
ceph-15.2.15/src/librbd/api/PoolMetadata.h:28:19: error: 'uint64_t' has not bee
n declared
ceph/15.2.15-r0/ceph-15.2.15/src/librbd/api/PoolMetadata.cc:133:5: error: no declaration matche
s 'int librbd::api::PoolMetadata<ImageCtxT>::list(librados::v14_2_0::IoCtx&, const std::string&, uint64_t, std::map<std::__cxx11::basic_string<cha
r>, ceph::buffer::v15_2_0::list>*)'
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Upstream-Status: Pending
---
src/librbd/api/PoolMetadata.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/librbd/api/PoolMetadata.h b/src/librbd/api/PoolMetadata.h
index c0a81735..69ab574a 100644
--- a/src/librbd/api/PoolMetadata.h
+++ b/src/librbd/api/PoolMetadata.h
@@ -7,6 +7,7 @@
#include "include/buffer_fwd.h"
#include "include/rados/librados_fwd.hpp"
+#include <cstdint>
#include <map>
#include <string>

View File

@ -23,6 +23,9 @@ SRC_URI = "http://download.ceph.com/tarballs/ceph-${PV}.tar.gz \
file://0004-kv-rocksdb_cache-implement-methods-required-by-rocks.patch \
file://0005-kv-rocksdb_cache-mark-Shard-const.patch \
file://0006-rocksdb-build-with-rocksdb-7.y.z.patch \
file://0001-common-fix-build-with-GCC-13-missing-cstdint-include.patch \
file://0002-common-replace-BitVector-NoInitAllocator-with-wrappe.patch \
file://0003-librdb-fix-build-with-gcc-13.patch \
"
SRC_URI[sha256sum] = "5dccdaff2ebe18d435b32bfc06f8b5f474bf6ac0432a6a07d144b7c56700d0bf"