Skip to content

Commit

Permalink
Merge pull request #7817 from Bo98/big-sur-system-linkage
Browse files Browse the repository at this point in the history
linkage_checker: handle system libraries on Big Sur
  • Loading branch information
MikeMcQuaid authored Jun 24, 2020
2 parents fd72547 + 9c4aaa9 commit be2dd90
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Library/Homebrew/linkage_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require "keg"
require "formula"
require "linkage_cache_store"
require "fiddle"

class LinkageChecker
attr_reader :undeclared_deps
Expand Down Expand Up @@ -125,6 +126,11 @@ def check_dylibs(rebuild_cache:)

if (dep = dylib_to_dep(dylib))
@broken_deps[dep] |= [dylib]
elsif MacOS.version >= :big_sur && dylib_found_via_dlopen(dylib)
# If we cannot associate the dylib with a dependency, then it may be a system library.
# In macOS Big Sur and later, system libraries do not exist on-disk and instead exist in a cache.
# If dlopen finds the dylib, then the linkage is not broken.
@system_dylibs << dylib
else
@broken_dylibs << dylib
end
Expand All @@ -151,6 +157,13 @@ def check_dylibs(rebuild_cache:)
end
alias generic_check_dylibs check_dylibs

def dylib_found_via_dlopen(dylib)
Fiddle.dlopen(dylib).close
true
rescue Fiddle::DLError
false
end

def check_formula_deps
filter_out = proc do |dep|
next true if dep.build?
Expand Down

0 comments on commit be2dd90

Please sign in to comment.