Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keg_relocate (linux): prepend gcc/lib/current to RPATH when needed #13631

Merged
merged 3 commits into from
Aug 2, 2022
Merged
Changes from 2 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: 7 additions & 0 deletions Library/Homebrew/extend/os/linux/keg_relocate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ def change_rpath(file, old_prefix, new_prefix)
lib_path = "#{new_prefix}/lib"
rpath << lib_path unless rpath.include? lib_path

# Add GCC's lib directory (as of GCC 12+) to RPATH when there is existing linkage.
# This fixes linkage for newly-poured bottles.
# TODO: Replace with
# rpath.map! { |path| path = path.sub(%r{lib/gcc/\d+$}, "lib/gcc/current") }
# when Homebrew/homebrew-core#106755 is merged.
rpath.prepend HOMEBREW_PREFIX/"opt/gcc/lib/gcc/current" if rpath.any? { |rp| rp.match?(%r{lib/gcc/\d+$}) }

rpath.join(":")
end
updated[:rpath] = new_rpath if old_rpath != new_rpath
Expand Down