Skip to content

Commit

Permalink
Improve fallback search path
Browse files Browse the repository at this point in the history
  • Loading branch information
larskanis committed Mar 30, 2024
1 parent a0995bc commit 12090bf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/ffi/dynamic_library.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@

module FFI
class DynamicLibrary
SEARCH_PATH = %w[/usr/lib /usr/local/lib /opt/local/lib]
SEARCH_PATH = []
%w[LD_LIBRARY_PATH DYLD_LIBRARY_PATH].each do |custom_path|
SEARCH_PATH.concat ENV.fetch(custom_path,"").split(File::PATH_SEPARATOR)
end
if FFI::Platform::ARCH == 'aarch64' && FFI::Platform.mac?
SEARCH_PATH << '/opt/homebrew/lib'
end
SEARCH_PATH.concat %w[/opt/local/lib /usr/local/lib /usr/lib]

SEARCH_PATH_MESSAGE = "Searched in <system library path>, #{SEARCH_PATH.join(', ')}".freeze

Expand Down

0 comments on commit 12090bf

Please sign in to comment.