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
Move /opt before /usr to search for M1 native libs first - solve the conflicts when both x64 and arm64 libs installed #936
Conversation
Hi @southwolf, thanks PS: I use it with react native |
Hi @notjulian yes that is the purpose of this PR. If you have installed native ARM64 libraries, it will use native libs first |
Thank you @southwolf for this! Can a project maintainer look at this? (ping @larskanis) It is a necessary step for using the ffi gem on Apple M1 natively -- which applies to nearly the full Mac line up today. Thanks! |
Thank you @southwolf ! Could project maintainer (@larskanis) updated this? :) |
@larskanis @Kerilk Hi ffi maintainers could you please take some time to review and merge this PR as a temporary solution if no better one available? More and more people are asking about the Apple Silicon compatibility issue. Thanks! |
@larskanis @Kerilk Hi we really need this solution to work... my thesis is burning on fire QQ |
@rainyjonne, @southwolf I am not a maintainer and shared libraries are not my subject of predilection, but I'll just throw my two cents here: The change you propose is impacting most platforms and can break the existing workflow of many. If those are indeed required for this specific platform, I would add a conditional for it, using this directory order only on those specific M1 Macs. You may need to add additional detection mechanisms to: https://github.com/ffi/ffi/blob/master/lib/ffi/platform.rb |
@Kerilk Thanks for pointing out! Agree with your point, but I didn't do that because in most cases people just use /usr/local as default installation path, /opt is only seen in MacOS + Apple Silicon scenarios AFAIK. Another reason I made a quick fix instead of a thorough solution is that maintainers of the library just ignored this PR (and all other related PRs/issues) without responses, so maybe I'll just leave it there as a temporary workaround or FYI. |
A proper solution would have a good chance to be merged. A hack/incompatibility like this will be ignored. So, a proper solution here is to add the Homebrew aarch64 path earlier, but only if the current process is aarch64. If it's amd64 or non-macOS, nothing should change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's reject this because it breaks other platforms needlessly.
#965 avoids the problem to affect other platforms.
#880 (comment) is about finding a correct and generic solution so the order hardly matters anymore.
This is trying to solve
#880 (comment)
In apple silicon machines, when both versions are installed, the native arm64 libs (
'/opt/local/lib/'
) should be the first option, and x64 ('/usr/local/lib/'
) as a failsafe fallback only when arm64 version is not available.In my case: I've installed both x64 & arm64 version of glib, but
ffi
found x64 and then stopped, giving up to try/opt
onesWhile placing
/opt
before/usr/local