Skip to content

Commit

Permalink
make-dist: patch rapidjson to fix FTBFS on GCC 14
Browse files Browse the repository at this point in the history
Without this, the build fails on GCC 14:

[ 3456s] /home/abuild/rpmbuild/BUILD/ceph-16.2.15-68-gbb20a17289a/src/rapidjson/include/rapidjson/document.h: In member function ‘rapidjson::GenericStringRef<CharType>& rapidjson::GenericStringRef<CharType>::operator=(const rapidjson::GenericStringRef<CharType>&)’:
[ 3456s] /home/abuild/rpmbuild/BUILD/ceph-16.2.15-68-gbb20a17289a/src/rapidjson/include/rapidjson/document.h:319:82: error: assignment of read-only member ‘rapidjson::GenericStringRef<CharType>::length’
[ 3456s]   319 |     GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
[ 3456s]       |                                                                           ~~~~~~~^~~~~~~~~~~~
[ 3456s] make[2]: *** [src/rgw/CMakeFiles/rgw_common.dir/build.make:1774: src/rgw/CMakeFiles/rgw_common.dir/rgw_crypt.cc.o] Error 1
[ 3456s] make[1]: *** [CMakeFiles/Makefile2:8011: src/rgw/CMakeFiles/rgw_common.dir/all] Error 2

The copy assignment operator was disabled in upstream rapidjson a very,
very, very long time ago:

Tencent/rapidjson@862c39b

This method of patching a submodule is pretty heinous, even for me.
The alternative would be to fork ceph's (very) old rapidjson to the
SUSE org, apply this path to that fork, and update ceph's .gitmodules
file to point to that instead of the ceph one.

Signed-off-by: Tim Serong <[email protected]>
  • Loading branch information
tserong committed Apr 9, 2024
1 parent fcc8d60 commit 55e91c0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions make-dist
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,29 @@ for tarball in $outfile.version \
rm $tarball.tar
done
mv $outfile.all.tar $outfile.tar
patch -p0 <<EOF
--- src/rapidjson/include/rapidjson/document.h.orig 2024-04-09 16:01:06.252689115 +1000
+++ src/rapidjson/include/rapidjson/document.h 2024-04-09 16:01:29.129152799 +1000
@@ -316,8 +316,6 @@
GenericStringRef(const GenericStringRef& rhs) : s(rhs.s), length(rhs.length) {}
- GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
-
//! implicit conversion to plain CharType pointer
operator const Ch *() const { return s; }
@@ -328,6 +326,8 @@
//! Disallow construction from non-const array
template<SizeType N>
GenericStringRef(CharType (&str)[N]) /* = delete */;
+ //! Copy assignment operator not permitted - immutable type
+ GenericStringRef& operator=(const GenericStringRef& rhs) /* = delete */;
};
//! Mark a character pointer as constant string
EOF
tar --update -f $outfile.tar $outfile/src/rapidjson/include/rapidjson/document.h
rm $outfile

echo "compressing..."
Expand Down

0 comments on commit 55e91c0

Please sign in to comment.