From 363e629b4d821395c123530eb83cf178edf4383f Mon Sep 17 00:00:00 2001 From: Daniel Burr Date: Sat, 25 Oct 2025 19:33:21 +0200 Subject: [PATCH 1/2] Prevent redefinition of clock_gettime() --- lib/libcompat.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libcompat.h b/lib/libcompat.h index b5983d70..7d539ba0 100644 --- a/lib/libcompat.h +++ b/lib/libcompat.h @@ -143,6 +143,7 @@ extern int fpclassify(double d); /* provides localtime and struct tm */ #ifdef HAVE_SYS_TIME_H +#define WIN_PTHREADS_TIME_H 1 #include #endif /* !HAVE_SYS_TIME_H */ #include From a2b143f7b39d6d0c3d6428ad691d8340bda7d317 Mon Sep 17 00:00:00 2001 From: Daniel Burr Date: Sat, 25 Oct 2025 20:18:11 +0200 Subject: [PATCH 2/2] Be less brute-force --- lib/libcompat.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/libcompat.h b/lib/libcompat.h index 7d539ba0..f3d6534f 100644 --- a/lib/libcompat.h +++ b/lib/libcompat.h @@ -143,9 +143,18 @@ extern int fpclassify(double d); /* provides localtime and struct tm */ #ifdef HAVE_SYS_TIME_H +#ifdef __MINGW64__ +#include <_mingw.h> +/* Version 13 and later of mingw-w64 provides an inline definition of + clock_gettime() in pthread_time.h, which conflicts with our version + from clock_gettime.c. By defining WIN_PTHREADS_TIME_H here we prevent + the pthread_time.h header from being included. */ +#if __MINGW64_VERSION_MAJOR > 12 #define WIN_PTHREADS_TIME_H 1 +#endif +#endif /* __MINGW64__ */ #include -#endif /* !HAVE_SYS_TIME_H */ +#endif /* HAVE_SYS_TIME_H */ #include /* declares fork(), _POSIX_VERSION. according to Autoconf.info,