summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/fmt/fmt/0001-Fix-compilation-on-clang-21-libc-21-4477.patch46
-rw-r--r--meta/recipes-devtools/fmt/fmt_11.2.0.bb4
2 files changed, 49 insertions, 1 deletions
diff --git a/meta/recipes-devtools/fmt/fmt/0001-Fix-compilation-on-clang-21-libc-21-4477.patch b/meta/recipes-devtools/fmt/fmt/0001-Fix-compilation-on-clang-21-libc-21-4477.patch
new file mode 100644
index 0000000000..911fa90a40
--- /dev/null
+++ b/meta/recipes-devtools/fmt/fmt/0001-Fix-compilation-on-clang-21-libc-21-4477.patch
@@ -0,0 +1,46 @@
1From f4345467fce7edbc6b36c3fa1cf197a67be617e2 Mon Sep 17 00:00:00 2001
2From: Remy Jette <remy@remyjette.com>
3Date: Sat, 21 Jun 2025 07:28:14 -0700
4Subject: [PATCH] Fix compilation on clang-21 / libc++-21 (#4477)
5
6`<cstdlib>` was not being included, so malloc and free were only declared
7via transitive includes. Some includes changed in the latest libc++-21
8build which broke fmt.
9
10Also changed `malloc`/`free` to `std::malloc` and `std::free`, as
11putting those symbols in the global namespace is optional for the
12implementation when including `<cstdlib>`.
13
14Upstream-Status: Backport [https://github.com/fmtlib/fmt/pull/4477]
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16---
17 include/fmt/format.h | 5 +++--
18 1 file changed, 3 insertions(+), 2 deletions(-)
19
20Index: fmt-11.2.0/include/fmt/format.h
21===================================================================
22--- fmt-11.2.0.orig/include/fmt/format.h
23+++ fmt-11.2.0/include/fmt/format.h
24@@ -44,6 +44,7 @@
25 # include <cmath> // std::signbit
26 # include <cstddef> // std::byte
27 # include <cstdint> // uint32_t
28+# include <cstdlib> // std::malloc, std::free
29 # include <cstring> // std::memcpy
30 # include <limits> // std::numeric_limits
31 # include <new> // std::bad_alloc
32@@ -744,12 +745,12 @@ template <typename T> struct allocator {
33
34 T* allocate(size_t n) {
35 FMT_ASSERT(n <= max_value<size_t>() / sizeof(T), "");
36- T* p = static_cast<T*>(malloc(n * sizeof(T)));
37+ T* p = static_cast<T*>(std::malloc(n * sizeof(T)));
38 if (!p) FMT_THROW(std::bad_alloc());
39 return p;
40 }
41
42- void deallocate(T* p, size_t) { free(p); }
43+ void deallocate(T* p, size_t) { std::free(p); }
44 };
45
46 } // namespace detail
diff --git a/meta/recipes-devtools/fmt/fmt_11.2.0.bb b/meta/recipes-devtools/fmt/fmt_11.2.0.bb
index d0d4cea23e..fd5dc0c4ab 100644
--- a/meta/recipes-devtools/fmt/fmt_11.2.0.bb
+++ b/meta/recipes-devtools/fmt/fmt_11.2.0.bb
@@ -5,7 +5,9 @@ LICENSE = "MIT"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=b9257785fc4f3803a4b71b76c1412729" 5LIC_FILES_CHKSUM = "file://LICENSE;md5=b9257785fc4f3803a4b71b76c1412729"
6 6
7SRC_URI = "git://github.com/fmtlib/fmt;branch=master;protocol=https;tag=${PV}\ 7SRC_URI = "git://github.com/fmtlib/fmt;branch=master;protocol=https;tag=${PV}\
8 file://0001-Workaround-an-ABI-issue-in-spdlog.patch" 8 file://0001-Workaround-an-ABI-issue-in-spdlog.patch \
9 file://0001-Fix-compilation-on-clang-21-libc-21-4477.patch \
10 "
9SRCREV = "40626af88bd7df9a5fb80be7b25ac85b122d6c21" 11SRCREV = "40626af88bd7df9a5fb80be7b25ac85b122d6c21"
10 12
11inherit cmake 13inherit cmake