From 4e08c5fcd8091afbac39704d8e4b0fa965c78c5c Mon Sep 17 00:00:00 2001 From: Ingo Franzki Date: Tue, 25 Nov 2025 16:50:22 +0100 Subject: [PATCH] common.mak: Fix the check for shared libraries with check_dep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The check_dep macro allows to pass additional compiler & linker options as 5th argument. This argument might contain shared libraries to link against (i.e. -lsomething). To ensure that the check_dep macro always attempts to link to these libraries '-Wl,--no-as-needed' is needed. At least on Ubuntu '-Wl,--as-needed' is the default, and with that, the library might get skipped if it is not really needed by the program built by the check_dep macro. Furthermore, with '-Wl,--as-needed' the order of the arguments matters, and thus a library specified in the 5th argument is at the wrong position, which leads to link errors and thus the check_dep macro will report that the dependency is not fulfilled, although it might be fulfilled. Signed-off-by: Ingo Franzki Reviewed-by: Jan Höppner Signed-off-by: Jan Höppner --- common.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.mak b/common.mak index 69ac7efe..e5f13430 100644 --- a/common.mak +++ b/common.mak @@ -201,7 +201,7 @@ endef # $5: Additional compiler & linker options (optional) # check_dep=\ -printf "\#include <%s>\n int main(void) {return 0;}\n" $2 | ( $(CC) $(filter-out --coverage, $(ALL_CFLAGS)) $(ALL_CPPFLAGS) $5 -o /dev/null -x c - ) > /dev/null 2>&1; \ +printf "\#include <%s>\n int main(void) {return 0;}\n" $2 | ( $(CC) $(filter-out --coverage, $(ALL_CFLAGS)) $(ALL_CPPFLAGS) -Wl,--no-as-needed $5 -o /dev/null -x c - ) > /dev/null 2>&1; \ if [ $$? != 0 ]; \ then \ printf " REQCHK %s (%s)\n" $1 $2; \