From a73c8223e4b014b8f9bbd166312e027b44753ca9 Mon Sep 17 00:00:00 2001 From: Violet Purcell Date: Sat, 26 Jul 2025 11:33:53 -0400 Subject: [PATCH] dev-util/ccache: fix build of bundled libfmt on libc++ 21 Signed-off-by: Violet Purcell Part-of: https://github.com/gentoo/gentoo/pull/43171 Signed-off-by: Sam James --- dev-util/ccache/ccache-4.11.3.ebuild | 1 + .../ccache-4.11.3-libfmt-libcxx-21.patch | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 dev-util/ccache/files/ccache-4.11.3-libfmt-libcxx-21.patch diff --git a/dev-util/ccache/ccache-4.11.3.ebuild b/dev-util/ccache/ccache-4.11.3.ebuild index 75a984d0cc3dd..d69fbff2400e6 100644 --- a/dev-util/ccache/ccache-4.11.3.ebuild +++ b/dev-util/ccache/ccache-4.11.3.ebuild @@ -75,6 +75,7 @@ PATCHES=( "${FILESDIR}"/${PN}-3.5-nvcc-test.patch "${FILESDIR}"/${PN}-4.0-objdump.patch "${FILESDIR}"/${PN}-4.11-avoid-run-user.patch + "${FILESDIR}"/${PN}-4.11.3-libfmt-libcxx-21.patch ) src_unpack() { diff --git a/dev-util/ccache/files/ccache-4.11.3-libfmt-libcxx-21.patch b/dev-util/ccache/files/ccache-4.11.3-libfmt-libcxx-21.patch new file mode 100644 index 0000000000000..f3a9572764c9c --- /dev/null +++ b/dev-util/ccache/files/ccache-4.11.3-libfmt-libcxx-21.patch @@ -0,0 +1,37 @@ +From https://github.com/fmtlib/fmt/commit/f4345467fce7edbc6b36c3fa1cf197a67be617e2 Mon Sep 17 00:00:00 2001 +From: Remy Jette +Date: Sat, 21 Jun 2025 07:28:14 -0700 +Subject: [PATCH] Fix compilation on clang-21 / libc++-21 (#4477) + +`` was not being included, so malloc and free were only declared +via transitive includes. Some includes changed in the latest libc++-21 +build which broke fmt. + +Also changed `malloc`/`free` to `std::malloc` and `std::free`, as +putting those symbols in the global namespace is optional for the +implementation when including ``. +--- a/src/third_party/fmt/fmt/format.h ++++ b/src/third_party/fmt/fmt/format.h +@@ -44,6 +44,7 @@ + # include // std::signbit + # include // std::byte + # include // uint32_t ++# include // std::malloc, std::free + # include // std::memcpy + # include // std::numeric_limits + # include // std::bad_alloc +@@ -755,12 +756,12 @@ template struct allocator : private std::decay { + + T* allocate(size_t n) { + FMT_ASSERT(n <= max_value() / sizeof(T), ""); +- T* p = static_cast(malloc(n * sizeof(T))); ++ T* p = static_cast(std::malloc(n * sizeof(T))); + if (!p) FMT_THROW(std::bad_alloc()); + return p; + } + +- void deallocate(T* p, size_t) { free(p); } ++ void deallocate(T* p, size_t) { std::free(p); } + }; + + } // namespace detail