Use unversioned GCC for runtime libraries when required.
See discussion at Homebrew/homebrew-core#110010.
This commit is contained in:
parent
520d9c3ab8
commit
a2081b488c
@ -20,9 +20,6 @@ module Homebrew
|
||||
].freeze
|
||||
private_constant :DYNAMIC_LINKERS
|
||||
|
||||
PREFERRED_GCC_RUNTIME_VERSION = OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA.split("@").last.freeze
|
||||
private_constant :PREFERRED_GCC_RUNTIME_VERSION
|
||||
|
||||
# We link GCC runtime libraries that are not specificaly used for Fortran,
|
||||
# which are linked by the GCC formula. We only use the versioned shared libraries
|
||||
# as the other shared and static libraries are only used at build time where
|
||||
@ -97,11 +94,13 @@ module Homebrew
|
||||
|
||||
# Add gcc to ld search paths
|
||||
ld_gcc_conf = ld_so_conf_d/"50-homebrew-preferred-gcc.conf"
|
||||
unless ld_gcc_conf.exist?
|
||||
ld_gcc_conf.atomic_write <<~EOS
|
||||
# This file is generated by Homebrew. Do not modify.
|
||||
#{gcc_opt_prefix}/lib/gcc/#{PREFERRED_GCC_RUNTIME_VERSION}
|
||||
EOS
|
||||
ld_gcc_conf_content = <<~EOS
|
||||
# This file is generated by Homebrew. Do not modify.
|
||||
#{gcc_opt_prefix}/lib/gcc/current
|
||||
EOS
|
||||
|
||||
if !ld_gcc_conf.exist? || (ld_gcc_conf.read != ld_gcc_conf_content)
|
||||
ld_gcc_conf.atomic_write ld_gcc_conf_content
|
||||
FileUtils.chmod "u=rw,go-wx", ld_gcc_conf
|
||||
|
||||
FileUtils.rm_f HOMEBREW_PREFIX/"etc/ld.so.cache"
|
||||
@ -118,7 +117,7 @@ module Homebrew
|
||||
# Remove legacy symlinks
|
||||
FileUtils.rm gcc_library_symlink if gcc_library_symlink.symlink?
|
||||
else
|
||||
gcc_library = gcc_opt_prefix/"lib/gcc/#{PREFERRED_GCC_RUNTIME_VERSION}/#{library}"
|
||||
gcc_library = gcc_opt_prefix/"lib/gcc/current/#{library}"
|
||||
# Skip if the link target doesn't exist.
|
||||
next unless gcc_library.readable?
|
||||
|
||||
|
@ -51,7 +51,7 @@ module OS
|
||||
LINUX_GLIBC_NEXT_CI_VERSION = "2.35"
|
||||
LINUX_GCC_CI_VERSION = "11.0"
|
||||
LINUX_PREFERRED_GCC_COMPILER_FORMULA = "gcc@11" # https://packages.ubuntu.com/jammy/gcc
|
||||
LINUX_PREFERRED_GCC_RUNTIME_FORMULA = "gcc@12" # https://packages.ubuntu.com/jammy/libstdc++6
|
||||
LINUX_PREFERRED_GCC_RUNTIME_FORMULA = "gcc"
|
||||
|
||||
if OS.mac?
|
||||
require "os/mac"
|
||||
|
Loading…
x
Reference in New Issue
Block a user