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

Fix FFI on M1 macs #198

Closed
wants to merge 1 commit into from
Closed

Fix FFI on M1 macs #198

wants to merge 1 commit into from

Conversation

iruoy
Copy link

@iruoy iruoy commented Apr 13, 2023

Fixes #178

I don't know why, but absolute paths are needed here. Atleast on M1.

Copy link
Member

@kleisauke kleisauke left a comment

Choose a reason for hiding this comment

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

LGTM! I left a suggestion inline.

Comment on lines +735 to +740
if (PHP_OS_FAMILY === "OSX" ||
PHP_OS_FAMILY === "Darwin") {
$glib_libname = $path . $glib_libname;
$gobject_libname = $path . $gobject_libname;
$vips_libname = $path . $vips_libname;
}
Copy link
Member

Choose a reason for hiding this comment

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

We can probably omit this if statement and always prepend the fallback path to the library names.

Suggested change
if (PHP_OS_FAMILY === "OSX" ||
PHP_OS_FAMILY === "Darwin") {
$glib_libname = $path . $glib_libname;
$gobject_libname = $path . $gobject_libname;
$vips_libname = $path . $vips_libname;
}
# Ensure the fallback path is prepended to the lib names, if any
$glib_libname = $path . $glib_libname;
$gobject_libname = $path . $gobject_libname;
$vips_libname = $path . $vips_libname;

@iruoy iruoy closed this by deleting the head repository Jun 28, 2023
jcupitt added a commit that referenced this pull request Jun 29, 2023
This PR adds a libraryLoad() function which searches a path for a library that
supports an API, then uses that to load libvips, libglib and libgobject.

This fixes #178 and #201

See also #198

Tested on macOS 13.4
@jcupitt jcupitt mentioned this pull request Jun 29, 2023
@jcupitt
Copy link
Member

jcupitt commented Jun 29, 2023

I've made #206 which I think fixes this issue.

@jcupitt
Copy link
Member

jcupitt commented Jun 29, 2023

Thank you for making this PR, @iruoy. I'm sorry I was so slow getting to it, I was trapped in a terrible work crunch. I hope my PR resolves this.

@iruoy
Copy link
Author

iruoy commented Jun 29, 2023

I actually didn't mean to close this. I was just cleaning out some repositories on my github. It looks like it caught your eye though. Thanks for making the improved PR, I will try it out this weekend or next week

jcupitt added a commit that referenced this pull request Jun 30, 2023
* improve library finding

This PR adds a libraryLoad() function which searches a path for a library that
supports an API, then uses that to load libvips, libglib and libgobject.

This fixes #178 and #201

See also #198

Tested on macOS 13.4

* fix formatting
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.

FFI\\Exception(code: 0): Failed loading 'libvips.42.dylib' after upgrade to v2 on M1 Mac
3 participants