Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/ffi/library.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ def ffi_lib(*names)
else
# TODO better library lookup logic
unless libname.start_with?("/") || FFI::Platform.windows?
path = ['/usr/lib/','/usr/local/lib/','/opt/local/lib/', '/opt/homebrew/lib/'].find do |pth|
path_candidates = if FFI::Platform::ARCH == 'aarch64' && FFI::Platform.mac?
['/opt/homebrew/lib/','/usr/lib/','/usr/local/lib/','/opt/local/lib/']
else
['/usr/lib/','/usr/local/lib/','/opt/local/lib/','/opt/homebrew/lib/']
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you remove /opt/homebrew/lib/ from this list? That seems only useful on darwin-arm64.

Also could you add a space after every comma, or even better use %w[path1 path2]?

end
path = path_candidates.find do |pth|
File.exist?(pth + libname)
end
if path
Expand Down