]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
jansson: Fix build with lld linker
authorKhem Raj <raj.khem@gmail.com>
Wed, 24 Jun 2026 23:21:19 +0000 (16:21 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 30 Jun 2026 07:10:14 +0000 (08:10 +0100)
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 <khem.raj@oss.qualcomm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-extended/jansson/jansson/0001-configure-only-use-default-symver-when-the-linker-su.patch [new file with mode: 0644]
meta/recipes-extended/jansson/jansson_2.15.0.bb

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 (file)
index 0000000..eb0c459
--- /dev/null
@@ -0,0 +1,45 @@
+From 7c44ab421c725ea6fed358f435c5461c0096f852 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+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 <raj.khem@gmail.com>
+---
+ 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],
index fda7a54ed8e9d83e1e9980720a6ea9ac8f3a6582..1a0b6f24acfea93ea5cc791accd158c9da078728 100644 (file)
@@ -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"