diff mbox series

[meta-oe,17/96] libabigail: Fix build with musl

Message ID 20261115074918.2932593-17-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-oe,01/96] crow: upgrade 1.3.4 -> 1.3.5 | expand

Commit Message

Khem Raj Nov. 15, 2026, 7:47 a.m. UTC
The 3.0 tools parse their options with argp, which musl does not
provide. Look for argp_parse in libargp at configure time, link the
tools with it, and depend on argp-standalone for musl.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 ...argp-standalone-when-the-C-library-l.patch | 48 +++++++++++++++++++
 .../libabigail/libabigail_3.0.bb              |  3 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-devtools/libabigail/libabigail/0001-Link-tools-with-argp-standalone-when-the-C-library-l.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/libabigail/libabigail/0001-Link-tools-with-argp-standalone-when-the-C-library-l.patch b/meta-oe/recipes-devtools/libabigail/libabigail/0001-Link-tools-with-argp-standalone-when-the-C-library-l.patch
new file mode 100644
index 0000000000..77c9beef55
--- /dev/null
+++ b/meta-oe/recipes-devtools/libabigail/libabigail/0001-Link-tools-with-argp-standalone-when-the-C-library-l.patch
@@ -0,0 +1,48 @@ 
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 12 Nov 2026 00:00:00 -0800
+Subject: [PATCH] Link tools with argp-standalone when the C library lacks argp
+
+The tools now parse their options with argp, which glibc provides but
+musl does not, so linking them fails there:
+
+  ld.lld: error: undefined symbol: argp_parse
+
+As is already done for fts, look for argp_parse in libargp when the C
+library does not have it, and link the tools with it.
+
+Upstream-Status: Submitted [https://inbox.sourceware.org/libabigail/20261113043746.2721849-1-raj.khem@gmail.com/]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ configure.ac      | 9 +++++++++
+ tools/Makefile.am | 2 +-
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -373,6 +373,15 @@ dnl glibc and BSD include fts into their
+ dnl check if we need to explicitly link to the standalone musl-fts.
+ AC_SEARCH_LIBS([fts_open], [fts])
+ 
++dnl The tools use argp, which glibc provides but musl does not, so check
++dnl if we need to explicitly link to the standalone argp library.
++save_LIBS="$LIBS"
++LIBS=
++AC_SEARCH_LIBS([argp_parse], [argp], [ARGP_LIBS="$LIBS"],
++               [AC_MSG_ERROR([argp_parse not found])])
++LIBS="$save_LIBS"
++AC_SUBST(ARGP_LIBS)
++
+ dnl Older glibc had a broken fts that didn't work with Large File Systems.
+ dnl We want the version that can handler LFS, but include workaround if we
+ dnl get a bad one. Add define to CFLAGS (not AC_DEFINE it) since we need to
+--- a/tools/Makefile.am
++++ b/tools/Makefile.am
+@@ -19,7 +19,7 @@ else
+ endif
+ 
+ noinst_PROGRAMS = abisym abinilint
+-LDADD = $(abs_top_builddir)/src/libabigail.la
++LDADD = $(abs_top_builddir)/src/libabigail.la $(ARGP_LIBS)
+ AM_LDFLAGS = -lpthread
+ 
+ abidiff_SOURCES = abidiff.cc
diff --git a/meta-oe/recipes-devtools/libabigail/libabigail_3.0.bb b/meta-oe/recipes-devtools/libabigail/libabigail_3.0.bb
index 4bff1209d6..9dbecacf79 100644
--- a/meta-oe/recipes-devtools/libabigail/libabigail_3.0.bb
+++ b/meta-oe/recipes-devtools/libabigail/libabigail_3.0.bb
@@ -5,11 +5,12 @@  LICENSE = "Apache-2.0 WITH LLVM-exception"
 LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab"
 
 SRC_URI = "http://mirrors.kernel.org/sourceware/${BPN}/${BP}.tar.xz \
+           file://0001-Link-tools-with-argp-standalone-when-the-C-library-l.patch \
            "
 SRC_URI[sha256sum] = "d34ea7c4b150f61e22edb1d16157e12c43fd18f8e8f09abce053d82ccaf92e06"
 
 DEPENDS = "elfutils libxml2 xxhash"
-DEPENDS:append:libc-musl = " fts"
+DEPENDS:append:libc-musl = " argp-standalone fts"
 
 inherit autotools pkgconfig lib_package