public inbox for buildroot@busybox.net
 help / color / mirror / Atom feed
From: Bernd Kuhls <bernd@kuhls.net>
To: buildroot@buildroot.org
Cc: "André Zwing" <nerv@dawncrow.de>,
	"Jérôme Pouiller" <jezz@sysmic.org>,
	"Pieter De Gendt" <pieter.degendt@gmail.com>,
	"Petr Vorel" <petr.vorel@gmail.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Adrian Perez de Castro" <aperez@igalia.com>,
	"Giulio Benetti" <giulio.benetti@benettiengineering.com>,
	"Romain Naour" <romain.naour@gmail.com>
Subject: [Buildroot] [PATCH v2 06/14] package/ntp: fix build with glibc 2.43
Date: Thu,  5 Mar 2026 22:09:41 +0100	[thread overview]
Message-ID: <20260305210950.3471974-7-bernd@kuhls.net> (raw)
In-Reply-To: <20260305210950.3471974-1-bernd@kuhls.net>

sntp/crypto.c includes sntp/config.h, then sntp/crypto.h which includes
ntp_stdlib.h which in turn includes l_stdlib.h that contains

  #ifndef HAVE_MEMCHR
  extern void *memchr(const void *s, int c, size_t n);
  #endif

and breaks the build with glibc 2.43.

sntp/config.h does not contain any information about memchr() while the
top-level config.h does but this top-level config.h is not included
because sntp/Makefile lacks -I$(top_builddir) so sntp/config.h gets
included which does not define HAVE_MEMCHR although glibc does provide
memchr() but sntp/configure lacks a check for memchr().

This was not a problem with previous glibc versions but due to recent
C23 changes in glibc the ntp build is now broken.

To fix the problem we add a configure check for memchr() to
sntp/configure so HAVE_MEMCHR gets defined in sntp/config.h.

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
 package/ntp/0007-memchr.patch | 42 +++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 package/ntp/0007-memchr.patch

diff --git a/package/ntp/0007-memchr.patch b/package/ntp/0007-memchr.patch
new file mode 100644
index 0000000000..a9c21042be
--- /dev/null
+++ b/package/ntp/0007-memchr.patch
@@ -0,0 +1,42 @@
+Fix build with glibc 2.43
+
+sntp/crypto.c includes sntp/config.h, then sntp/crypto.h which includes
+ntp_stdlib.h which in turn includes l_stdlib.h that contains
+
+  #ifndef HAVE_MEMCHR
+  extern void *memchr(const void *s, int c, size_t n);
+  #endif
+
+and breaks the build with glibc 2.43:
+
+./../include/l_stdlib.h:225:14: error: expected identifier or '(' before '_Generic'
+  225 | extern void *memchr(const void *s, int c, size_t n);
+
+sntp/config.h does not contain any information about memchr() while the
+top-level config.h does but this top-level config.h is not included
+because sntp/Makefile lacks -I$(top_builddir) so sntp/config.h gets
+included which does not define HAVE_MEMCHR although glibc does provide
+memchr() but sntp/configure lacks a check for memchr().
+
+This was not a problem with previous glibc versions but due to recent
+C23 changes in glibc the ntp build is now broken.
+
+To fix the problem we add a configure check for memchr() to
+sntp/configure so HAVE_MEMCHR gets defined in sntp/config.h.
+
+Upstream: https://bugs.ntp.org/show_bug.cgi?id=4015
+
+Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
+
+diff -uNr ntp-4.2.8p18/sntp/m4/ntp_libntp.m4 ntp-4.2.8p18/sntp/m4/ntp_libntp.m4
+--- ntp-4.2.8p18/sntp/m4/ntp_libntp.m4	2024-05-07 13:21:13.000000000 +0200
++++ ntp-4.2.8p18/sntp/m4/ntp_libntp.m4	2026-02-19 21:50:37.291724180 +0100
+@@ -77,7 +77,7 @@
+     ;;
+ esac
+ 
+-AC_CHECK_FUNCS([getclock stime timegm strlcpy strlcat])
++AC_CHECK_FUNCS([getclock memchr stime timegm strlcpy strlcat])
+ 
+ # Bug 2713
+ LDADD_LIBUTIL=
-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2026-03-05 21:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 21:09 [Buildroot] [PATCH v2 00/14] package/{glibc, localedef}: bump version to 2.43 Bernd Kuhls
2026-03-05 21:09 ` [Buildroot] [PATCH v2 01/14] package/socat: bump version to 1.8.1.1 Bernd Kuhls
2026-03-06 18:41   ` Julien Olivain via buildroot
2026-03-05 21:09 ` [Buildroot] [PATCH v2 02/14] package/lxc: bump version to 6.0.6 Bernd Kuhls
2026-03-05 21:09 ` [Buildroot] [PATCH v2 03/14] package/foot: bump version to 1.26.0 Bernd Kuhls
2026-03-05 21:09 ` [Buildroot] [PATCH v2 04/14] package/libkrb5: fix build with glibc 2.43 Bernd Kuhls
2026-03-05 21:09 ` [Buildroot] [PATCH v2 05/14] package/wlroots: " Bernd Kuhls
2026-03-05 21:09 ` Bernd Kuhls [this message]
2026-03-05 21:09 ` [Buildroot] [PATCH v2 07/14] package/waffle: " Bernd Kuhls
2026-03-05 21:09 ` [Buildroot] [PATCH v2 08/14] package/links: Fix " Bernd Kuhls
2026-03-05 21:09 ` [Buildroot] [PATCH v2 09/14] package/ltp-testsuite: fix " Bernd Kuhls
2026-03-05 21:09 ` [Buildroot] [PATCH v2 10/14] package/libvips: " Bernd Kuhls
2026-03-05 21:09 ` [Buildroot] [PATCH v2 11/14] package/freeswitch: disable mod_enum to " Bernd Kuhls
2026-03-05 21:09 ` [Buildroot] [PATCH v2 12/14] DEVELOPERS: remove Bernd Kuhls from libldns Bernd Kuhls
2026-03-14  7:53   ` Thomas Perale via buildroot
2026-03-05 21:09 ` [Buildroot] [PATCH v2 13/14] package/gcc/15.2.0: fix build with glibc 2.43 Bernd Kuhls
2026-03-05 21:09 ` [Buildroot] [PATCH v2 14/14] package/{glibc, localedef}: bump version to 2.43 Bernd Kuhls
2026-03-06 18:45   ` Julien Olivain via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260305210950.3471974-7-bernd@kuhls.net \
    --to=bernd@kuhls.net \
    --cc=aperez@igalia.com \
    --cc=buildroot@buildroot.org \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=jezz@sysmic.org \
    --cc=nerv@dawncrow.de \
    --cc=petr.vorel@gmail.com \
    --cc=pieter.degendt@gmail.com \
    --cc=romain.naour@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox