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

macos: look in alternate location for macfuse/osxfuse library #54

Merged
merged 1 commit into from
Feb 10, 2021

Conversation

ncw
Copy link
Contributor

@ncw ncw commented 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 #52

Copy link
Collaborator

@billziss-gh billziss-gh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ncw thanks for the PR. Please see my remarks about nested comments below.

fuse/host_cgo.go Outdated
@@ -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 */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the comment to a single-line comment (i.e. from /* MacFUSE/OSXFuse >= v4 */ to // MacFUSE/OSXFuse >= v4). Otherwise Go is confused from the nested /* */ comments.

fuse/host_cgo.go Outdated
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 */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my earlier remark.

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 Author

ncw commented Feb 10, 2021

I've fixed the comments 😊

I must have been having a regression back to C89!

@billziss-gh
Copy link
Collaborator

Thank you.

I can confirm that this builds and runs properly on my own Macs, both with older OSXFUSE and newer macFUSE 4.

@billziss-gh billziss-gh merged commit 11da055 into winfsp:master Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Add the new location for libfuse in MacOS
2 participants