package/mosquitto: fix build failure with make < 4.3
PATCH 1/1 package/mosquitto: fix build failure with make < 4.3
0002-Add-configure-time-check-for-lanl.patch (taken from mosquitto PR #3358) probes for -lanl with a $(shell ...) that pipes a small C program into $(CC):
NEED_LIBANL := $(shell printf '#include <stdlib.h>\n#include <netdb.h>\n...
The test program contains literal '#' characters. GNU make strips comments before expanding functions, and only since 4.3 does it keep '#' inside a function call argument intact. With older make the line is truncated at the first '#', so the shell call never sees its closing parenthesis:
config.mk:322: *** unterminated call to function 'shell': missing ')'. Stop.
That is why the package builds fine locally (make 4.3+) but fails on the build server, which ships an older GNU make.
Switch to the variant that was actually merged upstream (commit dfde35a, "Add compile time checks for whether -lanl is required"). It links an empty main() against -lanl instead of compiling a program that calls getaddrinfo_a(), so the test source needs no #include and contains no '#' at all, which works on every make version.
Upstream: https://github.com/eclipse-mosquitto/mosquitto/commit/dfde35aa0fa5863863f4d0c8f2bbefe39320a119
--- ...0002-Add-configure-time-check-for-lanl.patch | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
package/mosquitto/0002-Add-configure-time-check-for-lanl.patch +8 -9
@@ -1,4 +1,4 @@ -From 447a6aa8df882a67ca3df6f5e95be42e1463eaf0 Mon Sep 17 00:00:00 2001 +From 1db9a29f4c831b656600a64de0531516dd198641 Mon Sep 17 00:00:00 2001 From: Titouan Christophe <[email protected]> Date: Fri, 29 Aug 2025 19:47:34 +0200 Subject: [PATCH] Add configure-time check for -lanl
@@ -26,22 +26,21 @@ Signed-off-by: Titouan Christophe <[email protected]> 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config.mk b/config.mk -index 34d5163f..cc7987c4 100644 +index 34d5163f..594a7267 100644 --- a/config.mk +++ b/config.mk -@@ -318,8 +318,11 @@ ifeq ($(WITH_EC),yes) +@@ -318,7 +318,10 @@ ifeq ($(WITH_EC),yes) endif ifeq ($(WITH_ADNS),yes) - BROKER_LDADD:=$(BROKER_LDADD) -lanl - BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_ADNS -+ NEED_LIBANL := $(shell printf '#include <stdlib.h>\n#include <netdb.h>\nint main(){return getaddrinfo_a(0, NULL, 0, NULL);}'| $(CC) -D_GNU_SOURCE -o /dev/null -x c - 2>/dev/null || echo YES) -+ ifeq ($(NEED_LIBANL),YES) -+ BROKER_LDADD:=$(BROKER_LDADD) -lanl ++ NEED_LIBANL:=$(shell printf 'int main(){return 0;}' | gcc -D_GNU_SOURCE -lanl -o /dev/null -x c - 2>/dev/null || echo yes) ++ ifeq ($(NEED_LIBANL),yes) ++ BROKER_LDADD+=-lanl + endif + BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_ADNS endif - ifeq ($(WITH_CONTROL),yes) -- -2.50.1 +2.43.0
Signature · 6 lines
2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot