I created wrapper.h as
#define FUSE_USE_VERSION 25
#include <fuse_lowlevel.h>
and tried to generate bindings using the code
let bindings = bindgen::Builder::default()
.header("src/wrapper.h")
.clang_arg("-D_FILE_OFFSET_BITS=64")
.clang_arg("-I/usr/local/include/fuse") // Path to FUSE headers
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate()
.expect("Unable to generate bindings");
However it is failing with
--- stderr
/usr/local/include/fuse/fuse_lowlevel.h:42:12: fatal error: 'DiskArbitration/DiskArbitration.h' file not found
/usr/local/include/fuse/fuse_lowlevel.h:42:12: note: did not find header 'DiskArbitration.h' in framework 'DiskArbitration' (loaded from '/System/Library/Frameworks')
thread 'main' panicked at build.rs:15:10:
Unable to generate bindings: ClangDiagnostic("/usr/local/include/fuse/fuse_lowlevel.h:42:12: fatal error: 'DiskArbitration/DiskArbitration.h' file not found\n")
However when i created the following c file
#define FUSE_USE_VERSION 25
#include <fuse_lowlevel.h>
int main() {}
i was able to compile it using clang wrapper.c -I/usr/local/include/fuse -D_FILE_OFFSET_BITS=64
I don't understand why clang is able to find it here but not through bindings.
As a last resort I tried the following to preprocess it using clang and then generate bindings for it using clang -E -I/usr/local/include/fuse -D_FILE_OFFSET_BITS=64 wrapper.h -o processed.h
but the generated binding is a 26000 line mess 1mb in size so I don't think that's practical...