jansson hard-codes -Wl,--default-symver on glibc, which ld.lld does not
understand. Probe the linker for the option before using it so the recipe
builds with the clang/lld toolchain as well as GNU ld.

Signed-off-by: Khem Raj <[email protected]>
---
 ...se-default-symver-when-the-linker-su.patch | 45 +++++++++++++++++++
 .../jansson/jansson_2.15.0.bb                 |  4 +-
 2 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 
meta/recipes-extended/jansson/jansson/0001-configure-only-use-default-symver-when-the-linker-su.patch

diff --git 
a/meta/recipes-extended/jansson/jansson/0001-configure-only-use-default-symver-when-the-linker-su.patch
 
b/meta/recipes-extended/jansson/jansson/0001-configure-only-use-default-symver-when-the-linker-su.patch
new file mode 100644
index 0000000000..eb0c459f68
--- /dev/null
+++ 
b/meta/recipes-extended/jansson/jansson/0001-configure-only-use-default-symver-when-the-linker-su.patch
@@ -0,0 +1,45 @@
+From 7c44ab421c725ea6fed358f435c5461c0096f852 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 24 Jun 2026 14:04:19 -0700
+Subject: [PATCH] configure: only use --default-symver when the linker supports
+ it
+
+jansson enables symbol versioning on glibc by passing
+-Wl,--default-symver to the linker. This is a GNU ld option which is
+not understood by every linker, e.g. ld.lld errors out with:
+
+  ld.lld: error: unknown argument '--default-symver'
+
+Probe the linker with a link test before adding the flag so the build
+works with both GNU ld and lld. When the linker does not accept the
+option the symbol versioning provided by the explicit version script
+is still applied; only the implicit default version is dropped.
+
+Upstream-Status: Submitted [https://github.com/akheron/jansson/pull/744]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ configure.ac | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index e5c126a..1bb8b34 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -135,7 +135,16 @@ AC_SUBST(JSON_BSYMBOLIC_LDFLAGS)
+
+ # Enable symbol versioning on GNU libc
+ JSON_SYMVER_LDFLAGS=
+-AC_CHECK_DECL([__GLIBC__], [JSON_SYMVER_LDFLAGS=-Wl,--default-symver])
++AC_CHECK_DECL([__GLIBC__], [
++    saved_LDFLAGS="$LDFLAGS"
++    LDFLAGS="$LDFLAGS -Wl,--default-symver"
++    AC_MSG_CHECKING([whether the linker accepts -Wl,--default-symver])
++    AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
++        [AC_MSG_RESULT([yes])
++         JSON_SYMVER_LDFLAGS=-Wl,--default-symver],
++        [AC_MSG_RESULT([no])])
++    LDFLAGS="$saved_LDFLAGS"
++])
+ AC_SUBST([JSON_SYMVER_LDFLAGS])
+
+ AC_ARG_ENABLE([dtoa],
diff --git a/meta/recipes-extended/jansson/jansson_2.15.0.bb 
b/meta/recipes-extended/jansson/jansson_2.15.0.bb
index fda7a54ed8..1a0b6f24ac 100644
--- a/meta/recipes-extended/jansson/jansson_2.15.0.bb
+++ b/meta/recipes-extended/jansson/jansson_2.15.0.bb
@@ -5,7 +5,9 @@ LICENSE = "MIT & dtoa"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=d9911525d4128bee234ee2d3ccaa2537"
 
 GITHUB_BASE_URI = "https://github.com/akheron/jansson/releases";
-SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${BP}.tar.gz"
+SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${BP}.tar.gz \
+           
file://0001-configure-only-use-default-symver-when-the-linker-su.patch \
+                 "
 
 SRC_URI[sha256sum] = 
"070a629590723228dc3b744ae90e965a569efb9c535b3309b52e80e75d8eb3be"
 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#239533): 
https://lists.openembedded.org/g/openembedded-core/message/239533
Mute This Topic: https://lists.openembedded.org/mt/119966588/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to