[Buildroot] [PATCH] package/zstd: fix build failure on Microblaze
Giulio Benetti
giulio.benetti at benettiengineering.com
Sun Aug 14 03:12:08 UTC 2022
Building for Microblaze leads to error:
```
util.c: In function 'UTIL_utime':
util.c:173:27: error: 'stat_t' {aka 'const struct stat'} has no member named 'st_mtim'; did you mean 'st_mtime'?
173 | timebuf[1] = statbuf->st_mtim;
| ^~~~~~~
| st_mtime
```
Let's define _POSIX_C_SOURCE=199309L to make st_mtim struct member
visible again. Let's do this by using the already present MOREFLAGS
variable since CFLAGS gets overridden through zstd configuration.
Fixes:
http://autobuild.buildroot.net/results/aba/abaf20f73303bf7dfde7983f32b36d43db897ced/
Signed-off-by: Giulio Benetti <giulio.benetti at benettiengineering.com>
---
package/zstd/zstd.mk | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
index e8f6315222..6c8fcebd89 100644
--- a/package/zstd/zstd.mk
+++ b/package/zstd/zstd.mk
@@ -36,7 +36,12 @@ ZSTD_OPTS += HAVE_LZ4=0
endif
# zstd will append -O3 after $(CFLAGS), use MOREFLAGS to override again
-ZSTD_OPTS += MOREFLAGS="$(TARGET_OPTIMIZATION)"
+ZSTD_MOREFLAGS = $(TARGET_OPTIMIZATION)
+
+# with glibc 'struct stat's member 'st_mtim' requires _POSIX_C_SOURCE=199309L
+ZSTD_MOREFLAGS += -D_POSIX_C_SOURCE=199309L
+
+ZSTD_OPTS += MOREFLAGS="$(ZSTD_MOREFLAGS)"
ZSTD_BUILD_LIBS_BASENAMES = libzstd.pc
ifeq ($(BR2_STATIC_LIBS),y)
--
2.34.1
More information about the buildroot
mailing list