vi / execfuse

Turn a bunch of scripts into a FUSE filesystem
Other
30 stars 11 forks source link

compilation on error (and warnings) os osx 10.11.5 #2

Open ghost opened 8 years ago

ghost commented 8 years ago

Hi,

I'm trying to compile execfuse on osx, but I hit the following error .. Maybe someone will be able to advise what to do to fix them ?

cc -O2 -ggdb -Wall execfuse.c chunked_buffer.c execute_script.c -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BITINODE -I/usr/local/include/osxfuse/fuse -L/usr/local/lib -losxfuse -pthread -liconv -o execfuse execfuse.c:47:11: warning: format specifies type 'int ' but the argument has type 'nlink_t ' (aka 'unsigned short ') [-Wformat] ,&stbuf->st_nlink ^~~~ execfuse.c:50:11: warning: format specifies type 'long long ' but the argument has type 'dev_t ' (aka 'int ') [-Wformat] ,&stbuf->st_rdev ^~~~~~~ execfuse.c:52:11: warning: format specifies type 'long ' but the argument has type 'blksize_t ' (aka 'int ') [-Wformat] ,&stbuf->st_blksize ^~~~~~ execfuse.c:273:5: warning: 'sem_init' is deprecated [-Wdeprecated-declarations] sem_init(&i->sem, 0, 1); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/semaphore.h:55:5: note: 'sem_init' has been explicitly marked deprecated here int sem_init(sem_t *, int, unsigned int) *deprecated; ^ execfuse.c:378:5: warning: 'sem_destroy' is deprecated [-Wdeprecated-declarations] sem_destroy(&i->sem); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/semaphore.h:53:5: note: 'sem_destroy' has been explicitly marked deprecated here int sem_destroy(sem_t ) __deprecated; ^ execfuse.c:420:33: warning: format specifies type 'unsigned long long' but the argument has type 'dev_t' (aka 'int') [-Wformat] sprintf(b, "0x%016llx", rdev);


                      %016x
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS**)
                                                       ^~~~~~~~~~~
execfuse.c:525:6: error: field designator 'flag_nullpath_ok' does not refer to any field in type 'struct fuse_operations'
    .flag_nullpath_ok = 1,
     ^
6 warnings and 1 error generated.
execute_script.c:37:2: warning: implicitly declaring library function 'sprintf' with type 'int (char *, const char *, ...)' [-Wimplicit-function-declaration]
        sprintf(script_path, "%s/%s", directory, script_name);
        ^
execute_script.c:37:2: note: include the header <stdio.h> or explicitly provide a declaration for 'sprintf'
1 warning generated.
make: *_\* [execfuse] Error 1

Olivier
vi commented 8 years ago

What if remove .flag_nullpath_ok = 1,?

jimklimov commented 3 months ago

Poked on a Mac Monterey VM with Homebrew (brew install --cask macfuse@dev) currently at version 4.7.2, needs to be enabled via GUI, see https://formulae.brew.sh/cask/macfuse - and it too complains about some more items:

:; make
cc  -O2 -ggdb -Wall execfuse.c chunked_buffer.c execute_script.c -D_FILE_OFFSET_BITS=64 -I/usr/local/include/fuse -L/usr/local/lib -lfuse -pthread -o execfuse
execfuse.c:69:4: warning: format specifies type 'long *' but the argument has type 'blksize_t *' (aka 'int *') [-Wformat]
                ,&stbuf->st_blksize
                 ^~~~~~~~~~~~~~~~~~
execfuse.c:416:2: warning: 'sem_init' is deprecated [-Wdeprecated-declarations]
        sem_init(&info->sem, 0, 1);
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/semaphore.h:55:42: note: 'sem_init' has been explicitly marked deprecated here
int sem_init(sem_t *, int, unsigned int) __deprecated;
                                         ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:211:40: note: expanded from macro '__deprecated'
#define __deprecated    __attribute__((__deprecated__))
                                       ^
execfuse.c:561:3: warning: 'sem_destroy' is deprecated [-Wdeprecated-declarations]
                sem_destroy(&i->sem);
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/semaphore.h:53:26: note: 'sem_destroy' has been explicitly marked deprecated here
int sem_destroy(sem_t *) __deprecated;
                         ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:211:40: note: expanded from macro '__deprecated'
#define __deprecated    __attribute__((__deprecated__))
                                       ^
3 warnings generated.
chunked_buffer.c:3:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^~~~~~~~~~
1 error generated.
execute_script.c:1:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^~~~~~~~~~
1 error generated.
make: *** [execfuse] Error 1

on another run that got a few lines past the fixed warnings, also

execute_script.c:52:2: error: implicitly declaring library function 'sprintf' with type 'int (char *, const char *, ...)' [-Werror,-Wimplicit-function-declaration]
        sprintf(script_path, "%s/%s", directory, script_name);
        ^
execute_script.c:52:2: note: include the header <stdio.h> or explicitly provide a declaration for 'sprintf'

These bits are addressed in my PR #14 now :)

Despite the remaining warnings, the program seems to work for my PoC use-case on that platform too!