sys-cluster/ceph: fix build issue with FMT_STRING on clang 20+

1. add ceph-19.2.2-rgw-remove-FMT_STRING-to-fix-clang-20-build-failure.patch
   fix a build failure with clang 20+ where fmt’s compile-time format parsing
   fails in a consteval context.
2. use the system fmt for ceph 20+, as builds with the bundled one fail with
   FMT_STRING when using clang 20+.

Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/45459
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Z. Liu
2026-01-20 23:31:57 +08:00
committed by Sam James
parent 26a5c5614b
commit 5b6873f0f2
5 changed files with 57 additions and 4 deletions

View File

@@ -242,6 +242,7 @@ PATCHES=(
"${FILESDIR}/ceph-19.2.2-gcc15.patch"
"${FILESDIR}/ceph-19.2.2-ipv6.patch"
"${FILESDIR}/ceph-19.2.2-add-option-to-build-agains-system-opentelemetry.patch"
"${FILESDIR}/ceph-19.2.2-rgw-remove-FMT_STRING-to-fix-clang-20-build-failure.patch"
)
check-reqs_export_vars() {

View File

@@ -241,6 +241,7 @@ PATCHES=(
"${FILESDIR}/ceph-19.2.2-py313-3.patch"
"${FILESDIR}/ceph-19.2.2-gcc15.patch"
"${FILESDIR}/ceph-19.2.2-add-option-to-build-agains-system-opentelemetry.patch"
"${FILESDIR}/ceph-19.2.2-rgw-remove-FMT_STRING-to-fix-clang-20-build-failure.patch"
)
check-reqs_export_vars() {

View File

@@ -219,6 +219,7 @@ PATCHES=(
"${FILESDIR}/ceph-18.2.4-spdk.patch"
"${FILESDIR}/ceph-19.2.1-isa-l.patch"
"${FILESDIR}/ceph-19.2.2-add-option-to-build-agains-system-opentelemetry.patch"
"${FILESDIR}/ceph-19.2.2-rgw-remove-FMT_STRING-to-fix-clang-20-build-failure.patch"
"${FILESDIR}/ceph-20.1.0-nvmeof.patch"
)
@@ -343,8 +344,7 @@ ceph_src_configure() {
-DWITH_SYSTEM_UTF8PROC:BOOL=ON
-DCMAKE_INSTALL_DOCDIR:PATH="${EPREFIX}/usr/share/doc/${PN}-${PVR}"
-DCMAKE_INSTALL_SYSCONFDIR:PATH="${EPREFIX}/etc"
# use the bundled libfmt for now since they seem to constantly break their API
-DCMAKE_DISABLE_FIND_PACKAGE_fmt=ON
-DWITH_SYSTEM_FMT=ON
-Wno-dev
-DCEPHADM_BUNDLED_DEPENDENCIES=none
-DWITH_NVMEOF_GATEWAY_MONITOR_CLIENT:BOOL=$(usex nvmeof)

View File

@@ -219,6 +219,7 @@ PATCHES=(
"${FILESDIR}/ceph-18.2.4-spdk.patch"
"${FILESDIR}/ceph-19.2.1-isa-l.patch"
"${FILESDIR}/ceph-19.2.2-add-option-to-build-agains-system-opentelemetry.patch"
"${FILESDIR}/ceph-19.2.2-rgw-remove-FMT_STRING-to-fix-clang-20-build-failure.patch"
"${FILESDIR}/ceph-20.1.0-nvmeof.patch"
)
@@ -343,8 +344,7 @@ ceph_src_configure() {
-DWITH_SYSTEM_UTF8PROC:BOOL=ON
-DCMAKE_INSTALL_DOCDIR:PATH="${EPREFIX}/usr/share/doc/${PN}-${PVR}"
-DCMAKE_INSTALL_SYSCONFDIR:PATH="${EPREFIX}/etc"
# use the bundled libfmt for now since they seem to constantly break their API
-DCMAKE_DISABLE_FIND_PACKAGE_fmt=ON
-DWITH_SYSTEM_FMT=ON
-Wno-dev
-DCEPHADM_BUNDLED_DEPENDENCIES=none
-DWITH_NVMEOF_GATEWAY_MONITOR_CLIENT:BOOL=$(usex nvmeof)

View File

@@ -0,0 +1,51 @@
https://github.com/ceph/ceph/pull/66928
From 4965dbac4bd17973eb15fe09d2a046a509b4a65a Mon Sep 17 00:00:00 2001
From: "Z. Liu" <zhixu.liu@gmail.com>
Date: Wed, 14 Jan 2026 22:46:39 +0800
Subject: [PATCH] rgw: remove FMT_STRING to fix clang 20+ build failure
Fix a build failure with Clang 20+ using -std=c++20, where fmt
(v9.1.0, v11.0.0, and possibly other versions) fails to parse
format strings at compile-time in a consteval context. This is
a known issue in fmt, fixed in fmt v11.1.0 (see
https://github.com/fmtlib/fmt/commit/6797f0c39a4ef13061cbc3bb850c35af7428fdc4).
The following error occurs when building rgw_auth_s3.cc:
src/rgw/rgw_auth_s3.cc:600:22: error: call to consteval function
'fmt::basic_format_string<...>' is not a constant expression
Removing FMT_STRING avoids compile-time format string parsing
and restores buildability across different toolchains.
Test case:
#include <fmt/format.h>
std::string gen_v4_scope(const std::string& region)
{
return fmt::format(FMT_STRING("{:s}"), region);
}
Compile with:
clang -isystem fmt/include -std=c++20 -c test.cc
Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
diff --git a/src/rgw/rgw_auth_s3.cc b/src/rgw/rgw_auth_s3.cc
index c14a937685a..b31b0279d8e 100644
--- a/src/rgw/rgw_auth_s3.cc
+++ b/src/rgw/rgw_auth_s3.cc
@@ -605,7 +605,7 @@ string gen_v4_scope(const ceph::real_time& timestamp,
auto mon = bt.tm_mon + 1;
auto day = bt.tm_mday;
- return fmt::format(FMT_STRING("{:d}{:02d}{:02d}/{:s}/{:s}/aws4_request"),
+ return fmt::format("{:d}{:02d}{:02d}/{:s}/{:s}/aws4_request",
year, mon, day, region, service);
}
--
2.49.1