]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
libedit: fix build on clang+musl
authorRoss Burton <ross.burton@arm.com>
Wed, 10 Jun 2026 16:06:49 +0000 (17:06 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 11 Jun 2026 09:41:52 +0000 (10:41 +0100)
It turns out that the patch I deleted previously[1] is actually needed
in builds with both clang and musl.  Bring it back, whilst both talking
to upstream and resurrecting an old clang patch to resolve the underlying
issue.

[1] oe-core 1e31746fdc6 ("libedit: upgrade 20251016 -> 20260512")

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/libedit/libedit/0001-include-stdc-predef.patch [new file with mode: 0644]
meta/recipes-devtools/libedit/libedit_20260512-3.1.bb

diff --git a/meta/recipes-devtools/libedit/libedit/0001-include-stdc-predef.patch b/meta/recipes-devtools/libedit/libedit/0001-include-stdc-predef.patch
new file mode 100644 (file)
index 0000000..7600448
--- /dev/null
@@ -0,0 +1,47 @@
+From 8c92784f65bfd6828bcb05abbbdc0d4d6b3c003d Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Tue, 9 Jun 2026 16:20:56 +0100
+Subject: [PATCH] Explictly include stdc-predef.h
+
+This header checks the definition of __STDC_ISO_10646__, which according to the
+ISO C23 standard[1] will be conditionally defined by the implementation[2].
+
+- glibc defines this in stdc-predef.h, which is included by features.h.
+
+- musl defines this in stdc-predef.h, but nothing else in musl includes it.
+
+- gcc implicitly includes stdc-predef.h automatically
+
+- clang does not implicitly include stdc-predef.h (by choice[3])
+
+Thus on clang+musl builds this symbol is not defined.  Fix the build by
+explicitly including this header.
+
+There is work to fix this upstream in clang[4] but do the easy option and
+patch in the missing include for now.
+
+[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf is a public
+    draft that is identical to the final standard
+[2] ยง 6.10.10.3
+[3] https://clang.llvm.org/c_dr_status.html
+[4] https://github.com/llvm/llvm-project/pull/202919
+
+Upstream-Status: Submitted [mail to maintainer]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ src/chartype.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/chartype.h b/src/chartype.h
+index bcdb293..cb1203d 100644
+--- a/src/chartype.h
++++ b/src/chartype.h
+@@ -29,6 +29,8 @@
+ #ifndef _h_chartype_f
+ #define _h_chartype_f
++#include <stdc-predef.h>
++
+ /* Ideally we should also test the value of the define to see if it
+  * supports non-BMP code points without requiring UTF-16, but nothing
+  * seems to actually advertise this properly, despite Unicode 3.1 having
index 897bfbd6f6223aa65a7ac4057e9ad76715d91a0f..9d1b9a997211f6de9181fa99d8d3c63a74ef936d 100644 (file)
@@ -10,7 +10,9 @@ DEPENDS = "ncurses"
 
 inherit autotools
 
-SRC_URI = "http://www.thrysoee.dk/editline/${BP}.tar.gz"
+SRC_URI = "http://www.thrysoee.dk/editline/${BP}.tar.gz \
+           file://0001-include-stdc-predef.patch \
+           "
 SRC_URI[sha256sum] = "432d5e7ea8b0116dd39f2eca7bc11d0eed77faa6b77ea526ace89907c23ea4a0"
 
 # configure hardcodes /usr/bin search path bypassing HOSTTOOLS