Bug#962676: libzstd FTBFS for alpha: libc doesn't #define st_mtime
Source: libzstd
Version: 1.4.5+dfsg-1
Tags: ftbfs patch
User: helmutg@debian.org
Usertags: rebootstrap
libzstd fails to build from source on alpha. programs/util.c has code
that checks whether st_mtime is defined as a macro. If yes, it uses a
struct timespec. Otherwise a struct utimebuf. alpha is the only Debian
architecture that does not define st_mtime (while still providing the
field). The code in libzstd selects the struct utimebuf path and fails,
because that isn't declared.
I don't think that st_mtime is guaranteed to be a macro anywhere.
Therefore libzstd should cope with it not being one. The attached patch
achieves that by special casing alpha. Do you have any better ideas?
Helmut
--- libzstd-1.4.5+dfsg.orig/programs/util.c
+++ libzstd-1.4.5+dfsg/programs/util.c
@@ -148,8 +148,10 @@
/* We check that st_mtime is a macro here in order to give us confidence
* that struct stat has a struct timespec st_mtim member. We need this
* check because there are some platforms that claim to be POSIX 2008
- * compliant but which do not have st_mtim... */
-#if (PLATFORM_POSIX_VERSION >= 200809L) && defined(st_mtime)
+ * compliant but which do not have st_mtim...
+ * And then there is alpha, which doesn't define st_mtime, but still has it.
+ */
+#if (PLATFORM_POSIX_VERSION >= 200809L) && (defined(st_mtime) || defined(__alpha__))
{
/* (atime, mtime) */
struct timespec timebuf[2] = { {0, UTIME_NOW} };
Reply to: