Merge pull request #11459 from danielnachun/gcc_fix

super: fix GCC linkage issue in Linux
This commit is contained in:
Daniel Nachun 2021-06-02 20:23:53 -07:00 committed by GitHub
commit 273b06c822
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,10 +199,23 @@ module Superenv
sig { returns(T.nilable(PATH)) } sig { returns(T.nilable(PATH)) }
def determine_library_paths def determine_library_paths
paths = [ paths = []
keg_only_deps.map(&:opt_lib), if compiler.match?(GNU_GCC_REGEXP)
HOMEBREW_PREFIX/"lib", # Add path to GCC runtime libs for version being used to compile,
] # so that the linker will find those libs before any that may be linked in $HOMEBREW_PREFIX/lib.
# https://github.com/Homebrew/brew/pull/11459#issuecomment-851075936
begin
f = gcc_version_formula(compiler.to_s)
rescue FormulaUnavailableError
nil
else
paths << f.opt_lib/"gcc"/f.version.major if f.any_version_installed?
end
end
paths << keg_only_deps.map(&:opt_lib)
paths << HOMEBREW_PREFIX/"lib"
paths += homebrew_extra_library_paths paths += homebrew_extra_library_paths
PATH.new(paths).existing PATH.new(paths).existing
end end