Skip to content

Commit

Permalink
prioritize /opt/homebrew/lib for macos on aarch64 for searching path
Browse files Browse the repository at this point in the history
  • Loading branch information
dzprofessionerd committed Jun 26, 2022
1 parent 447845c commit c269088
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/ffi/library.rb
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/']
end
path = path_candidates.find do |pth|
File.exist?(pth + libname)
end
if path
Expand Down

0 comments on commit c269088

Please sign in to comment.