Skip to contentSkip to conversation

package/openntpd: fix static build with uClibc-ng and GCC >= 14

PATCH New Yegor Yefremov via buildroot 1 participant 1 message Nov 11

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/openntpd: fix static build with uClibc-ng and GCC >= 14

The configure check for __progname calls printf() without including <stdio.h>. Since GCC 14, implicit function declarations are an error, so the check always fails and compat/progname.c defines its own __progname. With BR2_STATIC_LIBS=y, this clashes with the definition in uClibc-ng's libc.a:

ld: .../sysroot/usr/lib/../lib64/libc.a(__uClibc_main.os):(.data.rel.local+0x8): multiple definition of `__progname'; ../compat/.libs/libcompat.a(progname.o):(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status

Backport upstream commit 8e4fdc1c2794 ("fix incompatible check for libc compat"), which adds the missing include. OPENNTPD_AUTORECONF is already set, so the fixed m4 macro is picked up.

This issue has been present since commit 5eb0203cb05c ("package/gcc:
add version 14.x"), which made GCC 14 available and thus turned the missing declaration into a failing configure check. It therefore affects 2024.05 and later, including the 2025.02.x, 2025.11.x and 2026.02.x maintenance branches.

Fixes:
https://autobuild.buildroot.org/results/bfcd46dc8d0b6799c7408845ba05737f039cddc0

Fixes 5eb0203cb05c0a65bdb7f89a2644eef7cff2dd27 ("package/gcc: add version 14.x")
Assisted-by Claude:claude-opus-5-5
---
 ...x-incompatible-check-for-libc-compat.patch | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 package/openntpd/0001-fix-incompatible-check-for-libc-compat.patch
package/openntpd/0001-fix-incompatible-check-for-libc-compat.patch new file +29 -0
new file mode 100644
index 0000000000..2a0bce7bec
@@ -0,0 +1,29 @@
+From 8e4fdc1c2794e861cd026864607fa6b04c5237cb Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <[email protected]>
+Date: Tue, 21 May 2024 16:10:45 -0400
+Subject: [PATCH] fix incompatible check for libc compat
+
+It relied on implicit function declarations, which are banned starting
+in c99. Result: the check always failed.
+
+See: https://wiki.gentoo.org/wiki/Modern_C_porting#How_do_I_reproduce_these_bugs.3F
+Bug: https://bugs.gentoo.org/900296
+
+Upstream: https://github.com/openntpd-portable/openntpd-portable/commit/8e4fdc1c2794e861cd026864607fa6b04c5237cb
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ m4/check-libc-compat.m4 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/m4/check-libc-compat.m4 b/m4/check-libc-compat.m4
+index a806cbe..3bb859a 100644
+--- a/m4/check-libc-compat.m4
++++ b/m4/check-libc-compat.m4
+@@ -1,6 +1,6 @@
+ AC_DEFUN([CHECK_PROGNAME], [
+ AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
+-       AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
++       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
+                 [[ extern char *__progname; printf("%s", __progname); ]])],
+         [ ac_cv_libc_defines___progname="yes" ],
+         [ ac_cv_libc_defines___progname="no"
Signature · 6 lines
2.34.1

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