Skip to content

Build against libFUSE 3 on macOS - #577

Merged
smessmer merged 3 commits into
feature/fuse3from
fix/fuse3-macos-support
Sep 7, 2026
Merged

smessmer merged 3 commits into
feature/fuse3from
fix/fuse3-macos-support

Conversation

@smessmer

@smessmer smessmer commented Sep 5, 2026

Copy link
Copy Markdown
Member

This is the macOS half of the blocker from the review: the sources are FUSE 3 only, but CMake still linked the FUSE 2 wrappers on macOS and Windows. Windows is not addressed here and needs a separate change; see the note at the end.

The problem

src/fspp/fuse/CMakeLists.txt resolved the pkg-config module fuse on Darwin, which is macFUSE's libFUSE 2.9 API, while Fuse.h and Fuse.cpp use fuse_config, fuse_readdir_flags, the three-argument getattr, the five-argument filler and FUSE_CAP_* unconditionally. Every macOS job in the branch's CI fails at build:

macos-14 / clang 15 (job 100906242424)
Fuse.h:57: error: unknown type name 'fuse_readdir_flags'
Fuse.h:60: error: unknown type name 'fuse_config'
Fuse.cpp:207: error: incompatible function pointer types assigning to
              'int (*)(const char *, struct stat *)'
              from 'int (*)(const char *, stat *, fuse_file_info *)'
Fuse.cpp:1117: error: too many arguments to function call, expected 4, have 5
14 errors generated.

Why macOS can simply move to FUSE 3

macFUSE has shipped libFUSE 3 since macFUSE 4.10.0 (March 2025); the current 5.3.3 carries libFUSE 3.18.2. It installs fuse3.pc, /usr/local/include/fuse3/ and libfuse3.4.dylib alongside the old libFUSE 2 files, so both APIs coexist and asking for fuse3 is enough. brew install --cask macfuse, which CI already uses, installs the official 5.3.3 package.

Sources: macFUSE 4.10.0 release notes, 5.3.3 notes, lib/meson.build on support/libfuse-3.18.

What rides along

The Darwin API extensions have to be off. macFUSE replaces six fuse_operations members with macOS-specific variants unless FUSE_DARWIN_ENABLE_EXTENSIONS is 0. getattr and readdir take a struct fuse_darwin_attr instead of a struct stat, statfs a struct statfs instead of a struct statvfs, utimens a timespec[3] instead of a timespec[2], and get/setxattr an extra position argument. params.h turns them off before including <fuse.h>, which is what libFUSE itself does when it builds on macOS.

utimens is worth calling out: it would compile either way, because timespec[2] and timespec[3] decay to the same pointer type in a function signature. It would then be handed a three-element array. That is a good reason to be explicit rather than to rely on the default.

pkg-config needs a hint. macFUSE installs into /usr/local, which is not on pkg-config's default search path when pkg-config comes from Homebrew on Apple Silicon, and the CI runners are macos-14, macos-15 and macos-26. CMake now prepends it. If libFUSE 3 is still not found, the error names macFUSE and the version that has it instead of just failing the pkg-config check.

A guard for the wrong header. params.h refuses a libFUSE 2 header outright, so someone on an older macFUSE gets one clear message rather than a wall of signature mismatches.

Unmounting needs no change. macFUSE builds no fusermount3 (its meson build excludes util/ on Darwin, and mounting goes through MFMount), and CryFS already calls umount on Apple.

Verification

macOS cannot be built here, so the operations table was compiled against macFUSE's own libFUSE 3.18.2 headers, fetched from macfuse/library at support/libfuse-3.18, with both GCC and Clang:

Configuration Result
__APPLE__, extensions on (the default) fails, exactly the Darwin variant mismatches
__APPLE__, extensions off (what this change does) compiles clean at FUSE_USE_VERSION 30, 39, 312, 317

With the extensions on, the errors are precisely the three ones expected:

error: incompatible function pointer types assigning to
  'int (*)(const char *, struct fuse_darwin_attr *, struct fuse_file_info *)'
  from 'int (*)(const char *, stat *, fuse_file_info *)'
error: ... assigning to 'int (*)(const char *, struct statfs *)'
  from 'int (*)(const char *, struct statvfs *)'
error: ... assigning to '... fuse_darwin_fill_dir_t ...' from '... fuse_fill_dir_t ...'

The #error guard was checked both ways: it fires against a FUSE 2 header and stays quiet against FUSE 3.

Linux is unaffected: fspp-test still passes 1007 tests.

Windows is still broken

Dokany's FUSE wrapper is still FUSE 2.7 and there is no libFUSE 3 version. Its dokan_fuse/include/fuse_common.h hardcodes FUSE_MAJOR_VERSION 2 / FUSE_MINOR_VERSION 7, getattr has no fuse_file_info, rename has no flags, init has no fuse_config, and there are no FUSE_CAP_* constants at all. dokany#182, asking for a newer FUSE API, has been open since 2016.

So Windows needs the compile-time FUSE 2 path that issue #419 describes, and that is a separate change. This one leaves the _MSC_VER branch exactly as it was and exempts Windows from the new header check, so nothing here stands in its way.

🤖 Generated with Claude Code

https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP


Generated by Claude Code

smessmer commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

The failing CI (windows-2022, Debug / Release / RelWithDebInfo) jobs are expected here and are not fixed by this PR.

This change is the macOS half of the blocker. Windows needs its own compile-time FUSE 2 path, because Dokany's FUSE wrapper is still FUSE 2.7 and there is no libFUSE 3 version of it. That is open as #578. The two are deliberately separate: they rewrite the same file for opposite reasons, macOS to select the FUSE 3 API and Windows to select the FUSE 2 one, and reviewing them together would obscure both. Whichever lands second needs a trivial merge in src/fspp/fuse/params.h, and I will do it.

The interesting signal on this PR is the macOS jobs. Please look at those rather than at the overall red.

I have not re-run the Windows jobs, because they fail with a deterministic compile error rather than intermittently.


Generated by Claude Code

smessmer commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

Pushed e182ffc, which finishes the version story this PR had already half-told. Shout if you would rather have it as its own pull request; I put it here because it is the same two files and the same sentence, "which libFUSE do we require".

The documented minimum is now enforced. The README and ChangeLog say libFUSE >= 3.9, but pkg_check_modules asked for fuse3 with no floor, so libFUSE 3.0 would build and link. It now asks for fuse3>=3.9.

That floor is deliberately in pkg-config and not in the preprocessor, because libFUSE 3.9.0 ships a stale FUSE_MINOR_VERSION 2 in its own headers, fixed only in 3.9.1. Measured against a real 3.9.0 install here:

$ grep FUSE_MINOR_VERSION fuse3-install/include/fuse3/fuse_common.h
#define FUSE_MINOR_VERSION 2

$ grep Version fuse3-install/.../fuse3.pc
Version: 3.9.0

So #if FUSE_VERSION < FUSE_MAKE_VERSION(3, 9) rejects exactly the version being required:

headers preprocessor floor pkg-config floor
libFUSE 3.9.0 rejects accepts
libFUSE 3.14.0 accepts accepts
libFUSE 3.17.2 accepts accepts
a 3.4.1 .pc n/a rejects

There is a comment in the CMake saying this, because it is the kind of thing someone will later try to "improve" into a header check.

FUSE_USE_VERSION now means 3.9. It was 39. libFUSE changed FUSE_MAKE_VERSION from major*10 + minor to major*100 + minor in 3.10.0, so on every header released since October 2020, 39 is not 3.9 at all. It is a number that means nothing and merely happens to land on the right side of each remaining guard: not == 30, not < 32, not < 35, but < FUSE_MAKE_VERSION(3,12), so it reads as "somewhere between 3.5 and 3.12". It is now 309, which is FUSE_MAKE_VERSION(3, 9) on a modern header and byte-identical to 39 on an older one. The nicer spelling FUSE_MAKE_VERSION(3, 9) is not usable in this file: it is shared with the Windows build and Dokany's headers have no such macro.

Neither change alters behaviour. CryFS only calls fuse_main, and none of libFUSE's three FUSE_USE_VERSION guards, for fuse_new, fuse_loop_mt and the ioctl prototype, applies to it. The operations table compiles clean at 309 under GCC and Clang against libFUSE 3.9.0, 3.14.0, 3.17.2 and macFUSE 3.18.2, and the FUSE 2 shape still compiles against Dokany's headers at 309 exactly as at 39. fspp-test passes 1007 tests.

One thing I could not check: macFUSE's fuse3.pc version string, since there is no Mac here. It bundles libFUSE 3.17 and 3.18, comfortably above the floor, so this should be safe, but the macOS jobs on this PR are the first real test of it.

On the merge with #578. I resolved it locally to confirm it is trivial: the two changes nest, _MSC_VER picking the API on the outside and __APPLE__ picking the extensions inside the non-Windows branch. Verified afterwards that Linux builds and passes, that the operations table still compiles against macFUSE 3.18.2 with the extensions off, and that Fuse.cpp still compiles against Dokany's headers on the FUSE 2 path. Nothing else in either PR conflicts.


Generated by Claude Code

smessmer commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

Checked the Windows build on e182ffc to make sure the version commit added nothing new. It did not, and it confirmed one thing I had only reasoned about.

The #error guard is correctly exempt on MSVC. It did not fire. That exemption is what lets #578 keep the FUSE 2 path, and until now I could only argue it, because _MSC_VER cannot be set on the Linux box I verify from. Now it is observed on a real MSVC build.

The remaining errors are exactly the five #578 addresses, and no others:

Fuse.cpp(1163): error C2065: 'config': undeclared identifier
Fuse.cpp(1168): error C2039: 'want': is not a member of 'fuse_conn_info'
                note: see declaration in DokanLibrary-2.2.0\include\fuse\fuse_common.h(92)
Fuse.cpp(1168): error C2065: 'FUSE_CAP_POSIX_LOCKS' / 'FUSE_CAP_ATOMIC_O_TRUNC' /
                'FUSE_CAP_EXPORT_SUPPORT': undeclared identifier
Fuse.h(63):     error C2061: syntax error: identifier 'fuse_readdir_flags'
Fuse.h(66):     error C2061: syntax error: identifier 'fuse_config'

That is init's config parameter, the capability mask, and the two FUSE 3 types in the header. #578 guards all five and declares the two types. Nothing in this PR's FUSE_USE_VERSION 309 change or the CMake floor shows up, which is what I wanted to confirm: the floor lives in the Linux and macOS branch, and Dokany's headers accept 309 exactly as they accepted 39.


Generated by Claude Code

Comment thread src/fspp/fuse/params.h Resolved
macOS still resolved the pkg-config module 'fuse', which is macFUSE's
libFUSE 2.9 API, while the sources are FUSE 3 only. Every macOS job in CI
fails at build, with errors like "unknown type name 'fuse_readdir_flags'"
and "too many arguments to function call, expected 4, have 5".

macFUSE has shipped libFUSE 3 since macFUSE 4.10.0 (March 2025), and the
current 5.3.3 carries libFUSE 3.18.2. It installs fuse3.pc,
/usr/local/include/fuse3 and libfuse3.4.dylib next to the old libFUSE 2
files, so the fix is to ask for 'fuse3' there as well.

Two things ride along.

macFUSE replaces six fuse_operations members with macOS specific variants
unless FUSE_DARWIN_ENABLE_EXTENSIONS is 0: getattr and readdir take a
'struct fuse_darwin_attr' instead of a 'struct stat', statfs a
'struct statfs' instead of a 'struct statvfs', utimens a timespec[3]
instead of a timespec[2], and get/setxattr an extra position argument.
params.h turns them off before including <fuse.h>, which is what libFUSE
itself does when it builds on macOS. Note that utimens would compile
either way, because both array sizes decay to the same pointer type, and
would then be handed a three element array.

macFUSE installs into /usr/local, which isn't on pkg-config's default
search path when pkg-config comes from Homebrew on Apple Silicon, so CMake
adds it. If libFUSE 3 still isn't found, the error now names macFUSE and
the version that has it instead of just failing the pkg-config check.

params.h also refuses a libFUSE 2 header outright, so an old macFUSE
produces one clear message instead of a wall of signature mismatches.
Windows is exempt from that check, because Dokany's FUSE wrapper is still
at FUSE 2.7 and needs a separate compile-time path; this commit does not
address Windows.

Unmounting needs no change. macFUSE has no fusermount3 and CryFS already
calls umount on Apple.

Verified by compiling the operations table against macFUSE's own libFUSE
3.18.2 headers with GCC and Clang, at FUSE_USE_VERSION 30, 39, 312 and 317:
it fails with exactly the Darwin variant mismatches when the extensions are
on, and compiles cleanly with them off.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP
…n 3.9

Two things about versions, both in code this change already touches.

The README and the ChangeLog say libFUSE >= 3.9, but nothing enforced it:
pkg_check_modules asked for 'fuse3' with no floor, so libFUSE 3.0 would
build and link. It now asks for 'fuse3>=3.9'.

The floor deliberately lives in pkg-config rather than in a preprocessor
check, because libFUSE 3.9.0 ships a stale FUSE_MINOR_VERSION of 2 in its own
headers, fixed only in 3.9.1. Verified against a real 3.9.0 install here: its
fuse3.pc says 3.9.0 while its fuse_common.h yields FUSE_VERSION == 32, so
'#if FUSE_VERSION < FUSE_MAKE_VERSION(3, 9)' rejects exactly the version being
required. There is a comment saying so, because it invites being "fixed".

FUSE_USE_VERSION was 39. libFUSE changed FUSE_MAKE_VERSION from
(major*10 + minor) to (major*100 + minor) in 3.10.0, so on every header
released since October 2020, 39 is not 3.9. It is a number that means nothing
and merely happens to fall on the right side of each of libFUSE's remaining
version guards. It is now 309, which is FUSE_MAKE_VERSION(3, 9) on a modern
header and behaves exactly like 39 on an older one. The nicer spelling,
FUSE_MAKE_VERSION(3, 9), is not usable here: this header is shared with the
Windows build and Dokany's FUSE 2.7 headers have no such macro.

Neither change alters behaviour. CryFS only calls fuse_main, and none of
libFUSE's three FUSE_USE_VERSION guards (fuse_new, fuse_loop_mt, the ioctl
prototype) applies to it.

Verified. The pkg-config floor accepts 3.9.0, 3.14.0 and 3.17.2 and rejects
3.4.1. The operations table compiles clean at FUSE_USE_VERSION 309 under GCC
and Clang against libFUSE 3.9.0, 3.14.0, 3.17.2 and macFUSE 3.18.2, and the
FUSE 2 shape still compiles against Dokany's headers at 309 exactly as at 39.
fspp-test passes 1007 tests.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP
I changed this to 309 in the previous commit on the argument that libfuse's
FUSE_MAKE_VERSION switched from (major*10 + minor) to (major*100 + minor) in
3.10.0, so 39 could no longer mean 3.9. That was wrong, and smessmer's review
question was right to push on it.

libfuse did not renumber the versions that already existed. The two-digit
values keep their meaning and the three-digit space starts at 3.10, so the
sequence is 29, 30, ... 39, 310, 311, 312. libfuse 3.17 still writes its own
guards for the old versions as literal 30, 32 and 35, and its own examples
still use 31, 34 and 35, switching to FUSE_MAKE_VERSION only from 3.12 on:

    example/hello.c:            #define FUSE_USE_VERSION 31
    example/hello_ll_uds.c:     #define FUSE_USE_VERSION 34
    example/ioctl.c:            #define FUSE_USE_VERSION 35
    example/passthrough_ll.c:   #define FUSE_USE_VERSION FUSE_MAKE_VERSION(3, 12)
    example/memfs_ll.cc:        #define FUSE_USE_VERSION 317

So 39 is the correct spelling for API 3.9, and it is 309 that has no meaning:
it falls in the gap between the two numbering spaces. Both happen to compile
the same today, which is what my measurement showed and why it did not catch
the mistake, but 39 is the value libfuse actually defines.

The pkg-config floor from the previous commit is unaffected and stays.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP
@smessmer
smessmer force-pushed the fix/fuse3-macos-support branch from 1e51325 to 048265a Compare September 6, 2026 20:20
smessmer pushed a commit that referenced this pull request Sep 7, 2026
Every run had three checks that could never finish. GitHub retired the
windows-2019 runner image, so jobs asking for it are never picked up: they sit
queued until they expire. On #577 the three windows-2019 jobs were still queued
after more than four hours, while all 127 other jobs in the same run, including
the three windows-2022 ones, had completed - those finished in about five
minutes. GitHub's runner-images README no longer lists windows-2019 at all; the
Windows images it offers are windows-2022, windows-2025, windows-2025-vs2026,
windows-11-arm and windows-11-vs2026-arm.

The effect was that no pull request in this repository could ever reach "all
checks passed", which made every red-or-green judgement on a pull request a
manual exercise in ignoring three permanently pending checks.

The compiler version stops being conditional at the same time. It selected the
Visual Studio 2019 toolset (192) for windows-2019 and 194 for windows-2022. With
one image left the condition is always true, and leaving it in place would
silently hand 192 to any runner image added to this matrix later. It is now the
literal 194, which is what windows-2022 already resolved to, so nothing changes
for the jobs that do run.

Deliberately not included:
- windows-2025 is not added in its place. It would be new, never-exercised
  coverage (Dokany install, MSVC toolset, conan profile), and adding it here
  would risk turning a change that makes CI honest into one that makes it red.
  Worth doing separately if a second Windows image is wanted.
- The "Requires Visual Studio 2019/2022" line in AGENTS.md is left alone.
  Dropping a runner removes CI coverage, not support, and narrowing the claimed
  support matrix is a project decision rather than a CI repair.

The CPack step keeps its windows-2022 condition, which is redundant with a
single image but still expresses that packaging happens on that one image and
not on any that might be added.

Verified the workflow still parses, the windows matrix now resolves to 3 jobs
instead of 6, and both job definitions and all triggers are unchanged.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP
smessmer added a commit that referenced this pull request Sep 7, 2026
* Drop the retired windows-2019 runner from CI

Every run had three checks that could never finish. GitHub retired the
windows-2019 runner image, so jobs asking for it are never picked up: they sit
queued until they expire. On #577 the three windows-2019 jobs were still queued
after more than four hours, while all 127 other jobs in the same run, including
the three windows-2022 ones, had completed - those finished in about five
minutes. GitHub's runner-images README no longer lists windows-2019 at all; the
Windows images it offers are windows-2022, windows-2025, windows-2025-vs2026,
windows-11-arm and windows-11-vs2026-arm.

The effect was that no pull request in this repository could ever reach "all
checks passed", which made every red-or-green judgement on a pull request a
manual exercise in ignoring three permanently pending checks.

The compiler version stops being conditional at the same time. It selected the
Visual Studio 2019 toolset (192) for windows-2019 and 194 for windows-2022. With
one image left the condition is always true, and leaving it in place would
silently hand 192 to any runner image added to this matrix later. It is now the
literal 194, which is what windows-2022 already resolved to, so nothing changes
for the jobs that do run.

Deliberately not included:
- windows-2025 is not added in its place. It would be new, never-exercised
  coverage (Dokany install, MSVC toolset, conan profile), and adding it here
  would risk turning a change that makes CI honest into one that makes it red.
  Worth doing separately if a second Windows image is wanted.
- The "Requires Visual Studio 2019/2022" line in AGENTS.md is left alone.
  Dropping a runner removes CI coverage, not support, and narrowing the claimed
  support matrix is a project decision rather than a CI repair.

The CPack step keeps its windows-2022 condition, which is redundant with a
single image but still expresses that packaging happens on that one image and
not on any that might be added.

Verified the workflow still parses, the windows matrix now resolves to 3 jobs
instead of 6, and both job definitions and all triggers are unchanged.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP

* Drop the explanatory comments from the CI matrix change

Review feedback: the comment explaining why windows-2019 was removed is not
needed in the workflow file - the reason belongs in the commit message and
the history, not next to the line that no longer exists. Removed it, and
trimmed the compiler_version comment down to the one line that documents
what 194 actually is.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP

---------

Co-authored-by: Claude <[email protected]>
@smessmer
smessmer merged commit f0a64bd into feature/fuse3 Sep 7, 2026
127 of 130 checks passed
@smessmer
smessmer deleted the fix/fuse3-macos-support branch September 7, 2026 02:14
smessmer pushed a commit that referenced this pull request Sep 7, 2026
The macOS jobs on this branch were failing to build with 'unknown type name
FUSE_OFF_T', because the base branch still resolved pkg-config module 'fuse' on
Darwin, which is macFUSE's libFUSE 2.9, so macOS compiled the FUSE 2 code path
meant for Dokany. #577 fixed that on the base. Merging it in so CI runs these
tests against a base that builds on macOS.
smessmer pushed a commit that referenced this pull request Sep 7, 2026
Picks up #577 (macOS libFUSE 3), #586 and #589 (the unreleased section is
1.1.0 now, which the changelog entry in this branch has to go under).
smessmer added a commit that referenced this pull request Sep 7, 2026
* Drop the retired windows-2019 runner from CI

Every run had three checks that could never finish. GitHub retired the
windows-2019 runner image, so jobs asking for it are never picked up: they sit
queued until they expire. On #577 the three windows-2019 jobs were still queued
after more than four hours, while all 127 other jobs in the same run, including
the three windows-2022 ones, had completed - those finished in about five
minutes. GitHub's runner-images README no longer lists windows-2019 at all; the
Windows images it offers are windows-2022, windows-2025, windows-2025-vs2026,
windows-11-arm and windows-11-vs2026-arm.

The effect was that no pull request in this repository could ever reach "all
checks passed", which made every red-or-green judgement on a pull request a
manual exercise in ignoring three permanently pending checks.

The compiler version stops being conditional at the same time. It selected the
Visual Studio 2019 toolset (192) for windows-2019 and 194 for windows-2022. With
one image left the condition is always true, and leaving it in place would
silently hand 192 to any runner image added to this matrix later. It is now the
literal 194, which is what windows-2022 already resolved to, so nothing changes
for the jobs that do run.

Deliberately not included:
- windows-2025 is not added in its place. It would be new, never-exercised
  coverage (Dokany install, MSVC toolset, conan profile), and adding it here
  would risk turning a change that makes CI honest into one that makes it red.
  Worth doing separately if a second Windows image is wanted.
- The "Requires Visual Studio 2019/2022" line in AGENTS.md is left alone.
  Dropping a runner removes CI coverage, not support, and narrowing the claimed
  support matrix is a project decision rather than a CI repair.

The CPack step keeps its windows-2022 condition, which is redundant with a
single image but still expresses that packaging happens on that one image and
not on any that might be added.

Verified the workflow still parses, the windows matrix now resolves to 3 jobs
instead of 6, and both job definitions and all triggers are unchanged.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP

* Drop the explanatory comments from the CI matrix change

Review feedback: the comment explaining why windows-2019 was removed is not
needed in the workflow file - the reason belongs in the commit message and
the history, not next to the line that no longer exists. Removed it, and
trimmed the compiler_version comment down to the one line that documents
what 194 actually is.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP

---------

Co-authored-by: Claude <[email protected]>
smessmer added a commit that referenced this pull request Sep 7, 2026
* Build against libFUSE 3 on macOS

macOS still resolved the pkg-config module 'fuse', which is macFUSE's
libFUSE 2.9 API, while the sources are FUSE 3 only. Every macOS job in CI
fails at build, with errors like "unknown type name 'fuse_readdir_flags'"
and "too many arguments to function call, expected 4, have 5".

macFUSE has shipped libFUSE 3 since macFUSE 4.10.0 (March 2025), and the
current 5.3.3 carries libFUSE 3.18.2. It installs fuse3.pc,
/usr/local/include/fuse3 and libfuse3.4.dylib next to the old libFUSE 2
files, so the fix is to ask for 'fuse3' there as well.

Two things ride along.

macFUSE replaces six fuse_operations members with macOS specific variants
unless FUSE_DARWIN_ENABLE_EXTENSIONS is 0: getattr and readdir take a
'struct fuse_darwin_attr' instead of a 'struct stat', statfs a
'struct statfs' instead of a 'struct statvfs', utimens a timespec[3]
instead of a timespec[2], and get/setxattr an extra position argument.
params.h turns them off before including <fuse.h>, which is what libFUSE
itself does when it builds on macOS. Note that utimens would compile
either way, because both array sizes decay to the same pointer type, and
would then be handed a three element array.

macFUSE installs into /usr/local, which isn't on pkg-config's default
search path when pkg-config comes from Homebrew on Apple Silicon, so CMake
adds it. If libFUSE 3 still isn't found, the error now names macFUSE and
the version that has it instead of just failing the pkg-config check.

params.h also refuses a libFUSE 2 header outright, so an old macFUSE
produces one clear message instead of a wall of signature mismatches.
Windows is exempt from that check, because Dokany's FUSE wrapper is still
at FUSE 2.7 and needs a separate compile-time path; this commit does not
address Windows.

Unmounting needs no change. macFUSE has no fusermount3 and CryFS already
calls umount on Apple.

Verified by compiling the operations table against macFUSE's own libFUSE
3.18.2 headers with GCC and Clang, at FUSE_USE_VERSION 30, 39, 312 and 317:
it fails with exactly the Darwin variant mismatches when the extensions are
on, and compiles cleanly with them off.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP

* Enforce the documented libFUSE minimum, and make FUSE_USE_VERSION mean 3.9

Two things about versions, both in code this change already touches.

The README and the ChangeLog say libFUSE >= 3.9, but nothing enforced it:
pkg_check_modules asked for 'fuse3' with no floor, so libFUSE 3.0 would
build and link. It now asks for 'fuse3>=3.9'.

The floor deliberately lives in pkg-config rather than in a preprocessor
check, because libFUSE 3.9.0 ships a stale FUSE_MINOR_VERSION of 2 in its own
headers, fixed only in 3.9.1. Verified against a real 3.9.0 install here: its
fuse3.pc says 3.9.0 while its fuse_common.h yields FUSE_VERSION == 32, so
'#if FUSE_VERSION < FUSE_MAKE_VERSION(3, 9)' rejects exactly the version being
required. There is a comment saying so, because it invites being "fixed".

FUSE_USE_VERSION was 39. libFUSE changed FUSE_MAKE_VERSION from
(major*10 + minor) to (major*100 + minor) in 3.10.0, so on every header
released since October 2020, 39 is not 3.9. It is a number that means nothing
and merely happens to fall on the right side of each of libFUSE's remaining
version guards. It is now 309, which is FUSE_MAKE_VERSION(3, 9) on a modern
header and behaves exactly like 39 on an older one. The nicer spelling,
FUSE_MAKE_VERSION(3, 9), is not usable here: this header is shared with the
Windows build and Dokany's FUSE 2.7 headers have no such macro.

Neither change alters behaviour. CryFS only calls fuse_main, and none of
libFUSE's three FUSE_USE_VERSION guards (fuse_new, fuse_loop_mt, the ioctl
prototype) applies to it.

Verified. The pkg-config floor accepts 3.9.0, 3.14.0 and 3.17.2 and rejects
3.4.1. The operations table compiles clean at FUSE_USE_VERSION 309 under GCC
and Clang against libFUSE 3.9.0, 3.14.0, 3.17.2 and macFUSE 3.18.2, and the
FUSE 2 shape still compiles against Dokany's headers at 309 exactly as at 39.
fspp-test passes 1007 tests.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP

* Keep FUSE_USE_VERSION at 39, not 309

I changed this to 309 in the previous commit on the argument that libfuse's
FUSE_MAKE_VERSION switched from (major*10 + minor) to (major*100 + minor) in
3.10.0, so 39 could no longer mean 3.9. That was wrong, and smessmer's review
question was right to push on it.

libfuse did not renumber the versions that already existed. The two-digit
values keep their meaning and the three-digit space starts at 3.10, so the
sequence is 29, 30, ... 39, 310, 311, 312. libfuse 3.17 still writes its own
guards for the old versions as literal 30, 32 and 35, and its own examples
still use 31, 34 and 35, switching to FUSE_MAKE_VERSION only from 3.12 on:

    example/hello.c:            #define FUSE_USE_VERSION 31
    example/hello_ll_uds.c:     #define FUSE_USE_VERSION 34
    example/ioctl.c:            #define FUSE_USE_VERSION 35
    example/passthrough_ll.c:   #define FUSE_USE_VERSION FUSE_MAKE_VERSION(3, 12)
    example/memfs_ll.cc:        #define FUSE_USE_VERSION 317

So 39 is the correct spelling for API 3.9, and it is 309 that has no meaning:
it falls in the gap between the two numbering spaces. Both happen to compile
the same today, which is what my measurement showed and why it did not catch
the mistake, but 39 is the value libfuse actually defines.

The pkg-config floor from the previous commit is unaffected and stays.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants