ada-fs / ptfs

Simple fuse based pass-through file system
Other
1 stars 0 forks source link

Build fail incomplete element type struct timespec #1

Closed JEdward7777 closed 2 years ago

JEdward7777 commented 3 years ago

The following errors prevent ptfs from compiling.

/usr/include/fuse/fuse.h:444:54: error: array type has incomplete element type ‘struct timespec’
  444 |  int (*utimens) (const char *, const struct timespec tv[2]);
      |                                                      ^~
/usr/include/fuse/fuse.h:444:45: warning: ‘struct timespec’ declared inside parameter list will not be visible outside of this definition or declaration
  444 |  int (*utimens) (const char *, const struct timespec tv[2]);
      |                                             ^~~~~~~~
/usr/include/fuse/fuse.h:867:29: error: array type has incomplete element type ‘struct timespec’
  867 |       const struct timespec tv[2]);

Searching the error message fatx also had the same error and the same solution worked.

The fatx issue references this pull and this stackoverflow reference.

Attached is a patch which implements the same correction which allows the compile to proceed and work.

From 2fd1b360b3b99db75a9fb148c4d4a03ce92aaef9 Mon Sep 17 00:00:00 2001
From: Joshua Lansford <Joshua@laserlinc.com>
Date: Fri, 13 Aug 2021 10:09:04 -0400
Subject: [PATCH] Fixed incomplete element type struct timespec error

---
 src/ptfs.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/ptfs.c b/src/ptfs.c
index 5245bf2..769fc67 100644
--- a/src/ptfs.c
+++ b/src/ptfs.c
@@ -4,6 +4,12 @@
  *
  */

+#define _XOPEN_SOURCE
+#if __STDC_VERSION__ >= 199901L
+#define _XOPEN_SOURCE 600
+#else
+#define _XOPEN_SOURCE 500
+#endif /* __STDC_VERSION__ */

 #define FUSE_USE_VERSION 30

-- 
2.25.1
JEdward7777 commented 3 years ago

Not sure if the patch didn't get mangled by MarkDown, so basically you need to add the following blob to the top of ptfs.c.

#define _XOPEN_SOURCE
#if __STDC_VERSION__ >= 199901L
#define _XOPEN_SOURCE 600
#else
#define _XOPEN_SOURCE 500
#endif /* __STDC_VERSION__ */
blastmaster commented 2 years ago

Fixed, thanks!