Build failure on macOS
GLib fails to build on macOS because of !2511 (merged).
../subprojects/glib/gio/gdbusauthmechanismsha1.c:529:75: error: implicit declaration of function '_g_stat_mtim_nsec' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
*mtime_nsec = _g_stat_mtime (&stat_buf) * G_USEC_PER_SEC * 1000 + _g_stat_mtim_nsec (&stat_buf);
^
../subprojects/glib/gio/gdbusauthmechanismsha1.c:529:75: note: did you mean '_g_stat_mtime'?
../subprojects/glib/gio/glocalfileinfo.h:319:25: note: '_g_stat_mtime' declared here
inline static time_t _g_stat_mtime (const GLocalFileStat *buf) { return buf->st_mtime; }
^
../subprojects/glib/gio/gdbusauthmechanismsha1.c:529:75: warning: this function declaration is not a prototype [-Wstrict-prototypes]
*mtime_nsec = _g_stat_mtime (&stat_buf) * G_USEC_PER_SEC * 1000 + _g_stat_mtim_nsec (&stat_buf);
^
1 warning and 1 error generated.
GLib on macOS does not have statx()
, and the fallback path for _g_stat_mtim_nsec()
depends on struct stat
having a st_mtim
field:
#if defined(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) || defined(G_OS_WIN32)
inline static guint32 _g_stat_atim_nsec (const GLocalFileStat *buf) { return buf->st_atim.tv_nsec; }
inline static guint32 _g_stat_ctim_nsec (const GLocalFileStat *buf) { return buf->st_ctim.tv_nsec; }
inline static guint32 _g_stat_mtim_nsec (const GLocalFileStat *buf) { return buf->st_mtim.tv_nsec; }
#endif
which does not exist on macOS:
#include <sys/stat.h>
void bar(void) {
struct stat foo;
foo.st_mtim.tv_nsec;
};
Compiler stdout:
Compiler stderr:
/Users/gitlab-runner/builds/_zbhPJ1A/0/GNOME/gtk/_build/meson-private/tmppwimr9j9/testfile.c:42:17: error: no member named 'st_mtim' in 'struct stat'
foo.st_mtim.tv_nsec;
~~~ ^
1 error generated.
Checking whether type "struct stat" has member "st_mtim.tv_nsec" : NO