Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add the new location for libfuse in MacOS #52

Closed
darthShadow opened this issue Dec 5, 2020 · 10 comments · Fixed by #54
Closed

Enhancement: Add the new location for libfuse in MacOS #52

darthShadow opened this issue Dec 5, 2020 · 10 comments · Fixed by #54

Comments

@darthShadow
Copy link

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

@billziss-gh
Copy link
Collaborator

Any chance of providing a PR? Although I still have Mac computers I make an effort to keep them on Mojave or earlier.

@darthShadow
Copy link
Author

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.

@darthShadow
Copy link
Author

I believe this also blocks on being unable to extract signed dmg(s), as mentioned by you here: #47 (comment)?

@ncw
Copy link
Contributor

ncw commented Feb 7, 2021

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.

@darthShadow
Copy link
Author

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.

@billziss-gh
Copy link
Collaborator

@ncw yes, please do provide PR if you can.

@billziss-gh
Copy link
Collaborator

@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.

@darthShadow
Copy link
Author

Makes sense, thanks for the explanation.

ncw added a commit to ncw/cgofuse that referenced this issue Feb 8, 2021
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 for the time being.

This patch looks in the newer location first, then in the older
location if that fails.

Release Notes: https://github.com/osxfuse/osxfuse/releases/tag/macfuse-4.0.0

Fixes winfsp#52
@ncw
Copy link
Contributor

ncw commented Feb 8, 2021

I created a PR for this #54 - I can't test this (no mac!) - can you @darthShadow ?

@darthShadow
Copy link
Author

Will do, but it will take some time.

ncw added a commit to ncw/cgofuse that referenced this issue Feb 10, 2021
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 for the time being.

This patch looks in the newer location first, then in the older
location if that fails.

Release Notes: https://github.com/osxfuse/osxfuse/releases/tag/macfuse-4.0.0

Fixes winfsp#52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants