Skip to contentSkip to conversation

package/mosquitto patch problem with gmake < 4.3

Buildroot Trammell Hudson via buildroot 2 participants 3 messages Oct 24, 2025 – Dec 12, 2025

lore
Share & tools
lore
#0 lore raw

The 0002-Add-configure-time-check-for-lanl.patch for package/mosquitto seems to have a compilation problem with older make, such as 4.2.1.  The handling of # characters in function calls or strings changed in 4.3 to no longer be treated as make end of line comments.

https://lists.gnu.org/archive/html/info-gnu/2020-01/msg00004.html

* WARNING: Backward-incompatibility! Number signs (#) appearing inside a macro reference or function invocation no longer introduce comments and should not be escaped with backslashes: thus a call such as: foo := $(shell echo '#') is legal. Previously the number sign needed to be escaped, for example: foo := $(shell echo '\#') Now this latter will resolve to "\#". If you want to write makefiles portable to both versions, assign the number sign to a variable: H := \# foo := $(shell echo '$H') This was claimed to be fixed in 3.81, but wasn't, for some reason. To detect this change search for 'nocomment' in the .FEATURES variable.

The error occurs when building mosquitto with an older make.

Quoted 1 line
Quoted 1 line
Quoted 1 line

mosquitto 2.0.22 Building

[...]config.mk:322: *** unterminated call to function 'shell': missing ')'.  Stop.
make[1]: *** [package/pkg-generic.mk:273: /data/scratch/build/shairport-pi/buildroot/output/build/mosquitto-2.0.22/.stamp_built] Error 2

The test is:

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)

Is there a minimum make version required?  And if so should the top level build check for it?

--
Trammell Hudson
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#1 lore raw

It looks like the -lanl test was solved in the upstream mosquitto without including any headers, so their upcoming 2.1.0 version does not cause the problem with older gmake:

https://github.com/eclipse-mosquitto/mosquitto/commit/9be6f9a409585b579efa4002c7a5da26ae6a996a#diff-02ffa64880a3e0c0e7d284d6e86512af1c93edff5c9fb91d2112a54a1f5bd8d4

Does that seem like a reasonable test or would it make sense to use the workaround proposed by the gnu make change notes?

config.mk renamed from config.mk.orig +5 -1
@@ -318,8 +318,12 @@
 endif
 
 ifeq ($(WITH_ADNS),yes)
-	BROKER_LDADD:=$(BROKER_LDADD) -lanl
 	BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_ADNS
+	HASH := \#
+	NEED_LIBANL := $(shell printf '$(HASH)include <stdlib.h>\n$(HASH)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
+	endif
 endif
 
 ifeq ($(WITH_CONTROL),yes)

I also did a quick grep through the various makefiles and config.mk in the other packages and do not see any problematic uses of # in make functions. busybox explicitly handles it by defining C:=\# in Makefile.flags to avoid older gmake problems.

Signature · 5 lines
Trammell
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Trammell" == Trammell Hudson via buildroot <[email protected]> writes:

Hi,

Sorry for the slow response.

Quoted 5 lines

It looks like the -lanl test was solved in the upstream mosquitto without including any headers, so their upcoming 2.1.0 version does not cause the problem with older gmake:

https://github.com/eclipse-mosquitto/mosquitto/commit/9be6f9a409585b579efa4002c7a5da26ae6a996a#diff-02ffa64880a3e0c0e7d284d6e86512af1c93edff5c9fb91d2112a54a1f5bd8d4

Ahh yes, as explained in the pull request there is an implementation of that in the fixes branch that we should just cherry pick and replace this patch:

https://github.com/eclipse-mosquitto/mosquitto/pull/3358

Care to give that a test and send a patch doing that to the Buildroot list?

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot