diff mbox series

[meta-oe] opensc: Fix libopensc link picking up build host libraries

Message ID 20260911144121.2278670-1-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-oe] opensc: Fix libopensc link picking up build host libraries | expand

Commit Message

Khem Raj Sept. 11, 2026, 2:41 p.m. UTC
libopensc failed to link:

  x86_64-yoe-linux-ld.lld: error: unable to find library -lgio-2.0
  x86_64-yoe-linux-ld.lld: error: unable to find library -lgobject-2.0

  libopensc_la_LINK = $(LIBTOOL) ... --tag=OBJC ... $(OBJCLD) ...

with OBJCLD = $(OBJC). The ENABLE_CRYPTOTOKENKIT conditional only keeps
the .m file out of the sources, automake still picks the linker
statically, so this happens on Linux too. AC_PROG_OBJC detects a bare
"x86_64-yoe-linux-clang" with none of the toolchain options, hence the
link ran without --sysroot:

  OBJC = x86_64-yoe-linux-clang
  CC   = ccache x86_64-yoe-linux-clang -target x86_64-yoe-linux ... \
         --sysroot=.../recipe-sysroot -std=gnu23

Point OBJC at the full CC

Also fix floating gio dependency: opensc's
--enable-notify defaults to "detect" and enables glib2 notification
support whenever gio-2.0 happens to be staged in the sysroot by some
other dependency

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 meta-oe/recipes-support/opensc/opensc_0.27.1.bb | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/opensc/opensc_0.27.1.bb b/meta-oe/recipes-support/opensc/opensc_0.27.1.bb
index 05b7a58be5..a1930744ea 100644
--- a/meta-oe/recipes-support/opensc/opensc_0.27.1.bb
+++ b/meta-oe/recipes-support/opensc/opensc_0.27.1.bb
@@ -29,11 +29,15 @@  EXTRA_OECONF = " \
 "
 EXTRA_OEMAKE = "DESTDIR=${D}"

+# Point OBJC at the full CC, helps computing AC_PROG_OBJC correctly
+export OBJC = "${CC}"
+
 PACKAGECONFIG ??= "pcsc"

 PACKAGECONFIG[openct] = "--enable-openct,--disable-openct,openct"
 PACKAGECONFIG[pcsc] = "--enable-pcsc,--disable-pcsc,pcsc-lite,pcsc-lite pcsc-lite-lib"
 PACKAGECONFIG[readline] = "--enable-readline,--disable-readline,readline"
+PACKAGECONFIG[notify] = "--enable-notify,--disable-notify,glib-2.0"

 FILES:${PN} += "\
     ${libdir}/opensc-pkcs11.so \