Hi Michael,

ti 21.7.2026 klo 19.57 Michael Kelly ([email protected]) kirjoitti:
> Have you incorporated the same changes as the previous iteration? These 
> addressed _GNU_SOURCE via the openntpd build system and also IOV_MAX. They 
> should get you close to a build but you won't get very much success running 
> it unless you are also building against and running with glibc and gnumach 
> from the latest git src.
>
> <https://lists.gnu.org/archive/html/bug-hurd/2026-04/msg00163.html>

Found. Updated. Enclosed. This gets me near the end of the build, but
fails to find any way to adjust the clock:

libtool: link: i686-gnu-gcc -g -O2
-Werror=implicit-function-declaration
-ffile-prefix-map=/home/perkelix/openntpd-7.9p1=.
-fstack-protector-strong -Wformat -Werror=format-security
-Wno-pointer-sign -Wall -std=gnu99 -fno-strict-aliasing
-DSYSCONFDIR=\"/etc/openntpd\" -DLOCALSTATEDIR=\"/var/lib/openntpd\"
-DRUNSTATEDIR=\"/run/openntpd\" -g -O2
-Werror=implicit-function-declaration
-ffile-prefix-map=/home/perkelix/openntpd-7.9p1=.
-fstack-protector-strong -Wformat -Werror=format-security
-Wno-pointer-sign -Wall -std=gnu99 -fno-strict-aliasing -Wl,-z
-Wl,relro -Wl,-z -Wl,now -o ntpd ntpd-client.o ntpd-config.o
ntpd-constraint.o ntpd-control.o ntpd-log.o ntpd-ntp.o ntpd-ntp_dns.o
ntpd-ntp_msg.o ntpd-ntpd.o ntpd-parse.o ntpd-fake-sensors.o
ntpd-server.o ntpd-util.o  -lresolv -lm ../compat/.libs/libcompat.a
-ltls
/usr/bin/ld: ntpd-ntpd.o: in function `ntpd_adjtime':
./src/./src/ntpd.c:541:(.text+0x366): undefined reference to
`update_time_sync_status'
/usr/bin/ld: ntpd-ntpd.o: in function `dispatch_imsg':
./src/./src/ntpd.c:493:(.text+0x916): undefined reference to
`update_time_sync_status'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:496: ntpd] Error 1

Martin-Éric
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin-Éric Racine <[email protected]>
Date: Tue Jul 21 11:30:31 EEST 2026
Subject: [PATCH] Port to Hurd

--- a/compat/Makefile.am
+++ b/compat/Makefile.am
@@ -53,6 +53,11 @@
 endif
 endif
 
+if HOST_GNU
+libcompat_la_SOURCES += adjfreq_hurd.c
+libcompat_la_SOURCES += hurd.c
+endif
+
 if HOST_OPENBSD
 libcompat_la_SOURCES += adjfreq_openbsd.c
 endif
--- /dev/null
+++ b/compat/adjfreq_hurd.c
@@ -0,0 +1,18 @@
+#if defined(__GNU__) || defined(HOST_GNU)
+
+#include <stdint.h>
+#include <errno.h>
+
+int
+adjfreq(const int64_t * __restrict freq, int64_t * __restrict oldfreq)
+{
+	if (oldfreq)
+		*oldfreq = 0;
+	if (freq && *freq != 0) {
+		errno = ENOSYS;
+		return -1;
+	}
+	return 0;
+}
+
+#endif
--- /dev/null
+++ b/compat/hurd.c
@@ -0,0 +1,16 @@
+#if defined(__GNU__) || defined(HOST_GNU)
+
+#include <sys/types.h>
+#include <errno.h>
+
+int
+adjfreq(const int64_t *freq, int64_t *oldfreq)
+{
+	if (oldfreq)
+		*oldfreq = 0;
+	if (freq && *freq != 0)
+		return EINVAL;
+	return 0;
+}
+
+#endif
--- a/compat/imsg-buffer.c
+++ b/compat/imsg-buffer.c
@@ -32,6 +32,17 @@
 
 #include "imsg.h"
 
+/* Fix for GNU/Hurd: IOV_MAX */
+#if defined(__GNU__) || defined(HOST_GNU)
+# if !defined(IOV_MAX)
+#  include <limits.h>
+#  include <sys/uio.h>
+#  if !defined(IOV_MAX)
+#   define IOV_MAX 1024
+#  endif
+# endif
+#endif
+
 struct ibufqueue {
 	TAILQ_HEAD(, ibuf)	bufs;
 	uint32_t		queued;
--- openntpd-7.9p1.orig/configure.ac
+++ openntpd-7.9p1/configure.ac
@@ -20,6 +20,10 @@
 AC_INIT([OpenNTPD], m4_esyscmd(tr -d '\n' < VERSION))
 
 AC_CANONICAL_HOST
+
+AM_CONDITIONAL([HOST_GNU], [test "x$host_os" = xgnu])
+AM_CONDITIONAL([_GNU_SOURCE], [test "x$host_os" = xgnu])
+
 AM_INIT_AUTOMAKE([subdir-objects foreign])
 AC_CONFIG_MACRO_DIR([m4])
 
--- openntpd-7.9p1.orig/m4/check-os-options.m4
+++ openntpd-7.9p1/m4/check-os-options.m4
@@ -110,6 +110,13 @@ char buf[1]; getentropy(buf, 1);
 		AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
 		AC_SUBST([PROG_LDADD], ['-lresolv'])
 		;;
+	*gnu*)
+		HOST_OS=gnu
+		HOST_ABI=elf
+		CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE -D__GNU__ -D__MACH__"
+		AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
+		AC_SUBST([PROG_LDADD], ['-lresolv'])
+		;;
 	*netbsd*)
 		HOST_OS=netbsd
 		HOST_ABI=elf
@@ -146,6 +153,7 @@ AM_CONDITIONAL([HOST_DARWIN],  [test x$H
 AM_CONDITIONAL([HOST_FREEBSD], [test x$HOST_OS = xfreebsd])
 AM_CONDITIONAL([HOST_HPUX],    [test x$HOST_OS = xhpux])
 AM_CONDITIONAL([HOST_LINUX],   [test x$HOST_OS = xlinux])
+AM_CONDITIONAL([HOST_GNU],     [test x$HOST_OS = xgnu])
 AM_CONDITIONAL([HOST_NETBSD],  [test x$HOST_OS = xnetbsd])
 AM_CONDITIONAL([HOST_OPENBSD], [test x$HOST_OS = xopenbsd])
 AM_CONDITIONAL([HOST_SOLARIS], [test x$HOST_OS = xsolaris])

Reply via email to