sgan81 / apfs-fuse

FUSE driver for APFS (Apple File System)
GNU General Public License v2.0
1.74k stars 164 forks source link

Pass USE_FUSE2 define to apfs-fuse build under macOS #134

Open msbit opened 3 years ago

msbit commented 3 years ago

On my mac, with the lastest OSXFUSE version (3.11.2), the version of FUSE that is installed is actually 2.9.7:

$ pkg-config --modversion osxfuse
2.9.7
$ pkg-config --modversion fuse
2.9.7

so compiling apfs-fuse without defining USE_FUSE2 breaks with the following output (which is the same as for https://github.com/sgan81/apfs-fuse/issues/118):

[ 93%] Building CXX object CMakeFiles/apfs-fuse.dir/apfsfuse/ApfsFuse.cpp.o
/Volumes/sensitive/apfs-fuse/apfsfuse/ApfsFuse.cpp:671:38: warning: unused parameter 'data' [-Wunused-parameter]
static int apfs_parse_fuse_opt(void *data, const char *arg, int key, struct fuse_args* outargs)
                                     ^
/Volumes/sensitive/apfs-fuse/apfsfuse/ApfsFuse.cpp:671:88: warning: unused parameter 'outargs' [-Wunused-parameter]
static int apfs_parse_fuse_opt(void *data, const char *arg, int key, struct fuse_args* outargs)
                                                                                       ^
/Volumes/sensitive/apfs-fuse/apfsfuse/ApfsFuse.cpp:927:7: error: no matching function for call to 'fuse_session_new'
        se = fuse_session_new(&args, &ops, sizeof(ops), nullptr);
             ^~~~~~~~~~~~~~~~
/usr/local/include/osxfuse/fuse/fuse_lowlevel.h:1646:22: note: candidate function not viable: requires 2 arguments, but 4 were provided
struct fuse_session *fuse_session_new(struct fuse_session_ops *op, void *data);
                     ^
/Volumes/sensitive/apfs-fuse/apfsfuse/ApfsFuse.cpp:932:8: error: use of undeclared identifier 'fuse_session_mount'; did you mean 'fuse_session_ops'?
                        if (fuse_session_mount(se, mountpoint) == 0)
                            ^
/usr/local/include/osxfuse/fuse/fuse_lowlevel.h:1603:8: note: 'fuse_session_ops' declared here
struct fuse_session_ops {
       ^
/Volumes/sensitive/apfs-fuse/apfsfuse/ApfsFuse.cpp:939:5: error: use of undeclared identifier 'fuse_session_unmount'
                                fuse_session_unmount(se);
                                ^
2 warnings and 3 errors generated.
make[2]: *** [CMakeFiles/apfs-fuse.dir/apfsfuse/ApfsFuse.cpp.o] Error 1
make[1]: *** [CMakeFiles/apfs-fuse.dir/all] Error 2
make: *** [all] Error 2

The fix here is to specify the same target_compile_definitions for builds with APPLE defined as for those without USE_FUSE3=ON would otherwise.

torarnv commented 3 years ago

Just hit this issue, and PR fixes it. Please merge :)