Fix compilation problems due to stat64() on Apple Silicon #33
Labels
No Label
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: a-j-wood/pv#33
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Date: Mon, 04 Jan 2021 19:25:25 +0100
From: Filippo Valsorda
Subject: PATCH: make pv compile on Apple Silicon
Since macOS 10.6, stat64 variants are equivalent to plain stat, and the suffixed versions have been removed in macOS 11 (although apparently only running on Apple Silicon). See stat(2).
diff --git a/src/include/pv-internal.h b/src/include/pv-internal.h
index 46d7496..fed25fe 100644
--- a/src/include/pv-internal.h
+++ b/src/include/pv-internal.h
@@ -18,6 +18,14 @@
#include <sys/time.h>
#include <sys/stat.h>
+// Since macOS 10.6, stat64 variants are equivalent to plain stat, and the
+// suffixed versions have been removed in macOS 11. See stat(2).
+#ifdef APPLE
+#define stat64 stat
+#define fstat64 fstat
+#define lstat64 lstat
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
That patch worked for me, except to change
to
Thanks @FiloSottile and @demitri, changes for this will be in the next release after 1.6.20.