Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
[libcxx22] devel/fmt build fix
To:
ports@openbsd.org
Date:
Wed, 19 Aug 2026 09:14:26 +0200

Download raw body.

Thread
fmt relies on libc++ headers pulling in stdlib.h somehow. This on longer
happens in llvm22's libc++, and the build fails.  The diff fixes this by
following the approach taken in

https://github.com/fmtlib/fmt/commit/b77a7516251d21aef1c6130dad116edff1a13173

It is not hard to update fmt itself to 12.2.0 which does build and pass
tests, but I seem to remember that this has a tendency of breaking things
that have embedded copies, so this seems the safer approach for now.

/usr/ports/pobj/fmt-11.2.0/fmt-11.2.0/include/fmt/format.h:747:28: error: use of undeclared identifier 'malloc'
  747 |     T* p = static_cast<T*>(malloc(n * sizeof(T)));
      |                            ^~~~~~
/usr/ports/pobj/fmt-11.2.0/fmt-11.2.0/include/fmt/format.h:752:35: error: use of undeclared identifier 'free'
  752 |   void deallocate(T* p, size_t) { free(p); }
      |                                   ^~~~

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/fmt/Makefile,v
diff -u -p -r1.7 Makefile
--- Makefile	19 Nov 2025 11:50:17 -0000	1.7
+++ Makefile	19 Aug 2026 07:07:52 -0000
@@ -3,6 +3,7 @@ COMMENT=		alternative formatting library
 GH_ACCOUNT=		fmtlib
 GH_PROJECT=		fmt
 GH_TAGNAME=		11.2.0
+REVISION=		0
 
 SHARED_LIBS=		fmt	2.1
 
Index: patches/patch-include_fmt_format_h
===================================================================
RCS file: patches/patch-include_fmt_format_h
diff -N patches/patch-include_fmt_format_h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-include_fmt_format_h	19 Aug 2026 07:07:42 -0000
@@ -0,0 +1,12 @@
+Index: include/fmt/format.h
+--- include/fmt/format.h.orig
++++ include/fmt/format.h
+@@ -41,6 +41,8 @@
+ #include "base.h"
+ 
+ #ifndef FMT_MODULE
++#  include <stdlib.h> // malloc, free
++
+ #  include <cmath>    // std::signbit
+ #  include <cstddef>  // std::byte
+ #  include <cstdint>  // uint32_t