execfuse icon indicating copy to clipboard operation
execfuse copied to clipboard

compilation on error (and warnings) os osx 10.11.5

Open ghost opened this issue 9 years ago • 2 comments

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_BIT_INODE -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

ghost avatar Jul 14 '16 19:07 ghost

What if remove .flag_nullpath_ok = 1,?

vi avatar Jul 25 '16 23:07 vi

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:

  • anonymous sem_init/sem_destroy are deprecated (and in fact no-ops) on the platform, named semaphores must be used:
    • https://stackoverflow.com/questions/1413785/sem-init-on-os-x
    • https://stackoverflow.com/questions/641126/posix-semaphores-on-mac-os-x-sem-timedwait-alternative (sample fallback implem available)
    • I fought the same battle in NUT with https://github.com/networkupstools/nut/pull/2539/commits/88e99eda5ace853b2d7e3261349915470bb7688a
  • malloc.h is absent, stdlib.h should suffice
  • stbuf->st_blksize int size mismatch, as detailed below
:; 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!

jimklimov avatar Aug 13 '24 22:08 jimklimov