package/usb_modeswitch: fix static build with jimtcl's zlib or openssl support
PATCH 1/1 package/usb_modeswitch: fix static build with jimtcl's zlib or openssl support
With BR2_STATIC_LIBS, the usb_modeswitch static dispatcher fails to link when jimtcl is built with its zlib extension or ssl support:
[...]/sysroot/usr/lib/../lib64/libjim.a(jim-zlib.o): in function `Jim_Compress':
jim-zlib.c:(.text+0x3d8): undefined reference to `deflateInit2_' [...]
make[1]: *** [Makefile:41: dispatcher-statlink] Error 1
The dispatcher is linked with -l:libjim.a only, not with the libraries libjim.a depends on.
Add a patch, sent upstream, adding the libraries listed by jimtcl's pkg-config file for static linking, and add the missing host-pkgconf dependency, as the Makefile uses pkg-config.
Since commit 283821fc31c4 ("package/jimtcl: bump to version 0.83"), jimtcl enables its zlib extension and ssl support when zlib and openssl are found, so this failed whenever they happened to be built before jimtcl. Since commit a416a8ef0972 ("package/jimtcl: fix optional openssl and zlib dependencies"), which made them proper dependencies of jimtcl, it fails every time zlib or openssl is enabled. The issue therefore affects 2025.11 and later (randomly), and fails consistently on master.
Fixes:
https://autobuild.buildroot.org/results/40e1490b9b64f96b5574bd8cd1ceaa4e6d50b7ca
--- ...e-static-dispatcher-with-jimtcl-s-de.patch | 47 +++++++++++++++++++ package/usb_modeswitch/usb_modeswitch.mk | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 package/usb_modeswitch/0002-Makefile-link-the-static-dispatcher-with-jimtcl-s-de.patch
package/usb_modeswitch/0002-Makefile-link-the-static-dispatcher-with-jimtcl-s-de.patch new file +47 -0
@@ -0,0 +1,47 @@ +From 10fa184cd0f5cb347fbb60d92ca0cb9834db0103 Mon Sep 17 00:00:00 2001 +From: Yegor Yefremov <[email protected]> +Date: Mon, 26 Oct 2026 09:36:18 +0100 +Subject: [PATCH] Makefile: link the static dispatcher with jimtcl's + dependencies + +The static dispatcher links libjim.a with -l:libjim.a, but not with the +libraries it depends on. When jimtcl is built with optional features +using external libraries, such as its zlib extension or ssl support in +the aio extension, the link then fails: + + jim-zlib.c:(.text+0xcf): undefined reference to `inflateInit2_' + +Add the libraries listed by jimtcl's pkg-config file for static linking. +If pkg-config doesn't know jimtcl, nothing is added, as before. + +Upstream: sent to Josua Dietze <[email protected]> on 2026-10-29 +Assisted-by: Claude:claude-opus-5-5 +Signed-off-by: Yegor Yefremov <[email protected]> +--- + Makefile | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index fc2c0cd..41a15e7 100644 +--- a/Makefile ++++ b/Makefile +@@ -3,6 +3,7 @@ VERS = 2.6.1 + CC ?= gcc + CFLAGS += -Wall -Wno-deprecated-declarations + LIBS = `pkg-config --libs --cflags libusb-1.0` ++JIMLIBS = `pkg-config --static --libs jimtcl 2>/dev/null` + RM = /bin/rm -f + OBJS = usb_modeswitch.c + PREFIX = $(DESTDIR)/usr +@@ -38,7 +39,7 @@ dispatcher-dynlink: dispatcher.c dispatcher.h + + dispatcher-statlink: dispatcher.c dispatcher.h + DISPATCH=dispatcher-statlink +- $(CC) dispatcher.c $(LDFLAGS) -l:libjim.a -ldl -Ijim -o usb_modeswitch_dispatcher $(CFLAGS) ++ $(CC) dispatcher.c $(LDFLAGS) -l:libjim.a $(JIMLIBS) -ldl -Ijim -o usb_modeswitch_dispatcher $(CFLAGS) + + dispatcher.h: usb_modeswitch_dispatcher.tcl + ./make_string.sh usb_modeswitch_dispatcher.tcl > $@ +-- +2.34.1 +
package/usb_modeswitch/usb_modeswitch.mk +1 -1
@@ -7,7 +7,7 @@ USB_MODESWITCH_VERSION = 2.6.2 USB_MODESWITCH_SOURCE = usb-modeswitch-$(USB_MODESWITCH_VERSION).tar.bz2 USB_MODESWITCH_SITE = http://www.draisberghof.de/usb_modeswitch -USB_MODESWITCH_DEPENDENCIES = libusb +USB_MODESWITCH_DEPENDENCIES = host-pkgconf libusb USB_MODESWITCH_LICENSE = GPL-2.0+, BSD-2-Clause USB_MODESWITCH_LICENSE_FILES = COPYING
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot