Closed darthShadow closed 3 years ago
Any chance of providing a PR? Although I still have Mac computers I make an effort to keep them on Mojave or earlier.
This section of the code is unfortunately in C, which I have no experience with and don't have much interest or time to learn it right now, sorry.
I believe this also blocks on being unable to extract signed dmg(s), as mentioned by you here: https://github.com/billziss-gh/cgofuse/issues/47#issuecomment-653695967?
I think a patch like this should fix the shared library location
diff --git a/fuse/host_cgo.go b/fuse/host_cgo.go
index 0676732..a7e9275 100644
--- a/fuse/host_cgo.go
+++ b/fuse/host_cgo.go
@@ -168,7 +168,9 @@ static void *cgofuse_init_fuse(void)
void *h;
#if defined(__APPLE__)
- h = dlopen("/usr/local/lib/libosxfuse.2.dylib", RTLD_NOW);
+ h = dlopen("/usr/local/lib/libfuse.2.dylib", RTLD_NOW); /* MacFUSE/OSXFuse >= v4 */
+ if (0 == h)
+ h = dlopen("/usr/local/lib/libosxfuse.2.dylib", RTLD_NOW); /* MacFUSE/OSXFuse < v4 */
#elif defined(__FreeBSD__)
h = dlopen("libfuse.so.2", RTLD_NOW);
#elif defined(__NetBSD__)
The include file location doesn't seem to be a problem when compiling with macfuse v4 as moving the include to /usr/local/include
means the #include "fuse/whatever
just work as /usr/local/include
is on the include path by default. It makes the -I/usr/local/include/osxfuse/fuse
irrelevant, but it is harmless and backwards compatible
If you think the above is OK @billziss-gh I'll send a PR.
One minor point to consider that may be relevant is when the older include path /usr/local/include/osxfuse/fuse
is removed from the package. This may cause issues if the older path is still available and has an older version of osxfuse/macfuse present than the one available in /usr/local/include/fuse
.
This should probably be handled by the include path order but wanted to confirm anyway.
@ncw yes, please do provide PR if you can.
@darthShadow
Unless latest macOS FUSE has changed its ABI (e.g. changing the order of operations in struct fuse_operations
), it should not be a problem using the wrong header.
If we are worried about this we can add a -I/usr/local/include
prior to the existing -I
option; however there is a possibility this might cause problems on existing systems, so I am inclined to leave the include file locations as they are.
Makes sense, thanks for the explanation.
I created a PR for this https://github.com/billziss-gh/cgofuse/pull/54 - I can't test this (no mac!) - can you @darthShadow ?
Will do, but it will take some time.
With MacFUSE i.e. OSXFuse 4.0, the location of the loadable library has changed to
/usr/local/lib/libfuse.2.dylib
instead of/usr/local/lib/libosxfuse.2.dylib
. The older path is still present for backwards compatibility but it is probably better to use the newer path if available.The include path also seems to have changed
/usr/local/include/fuse
instead of/usr/local/include/osxfuse/fuse
.Release Notes: https://github.com/osxfuse/osxfuse/releases/tag/macfuse-4.0.0