Use GCC 12 for runtime libraries

This commit is contained in:
Bo Anderson 2022-09-18 00:58:47 +01:00
parent 7a14ae6187
commit 66fa1f7e6a
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
5 changed files with 9 additions and 6 deletions

View File

@ -4,6 +4,6 @@
class CompilerSelector
sig { returns(String) }
def self.preferred_gcc
OS::LINUX_PREFERRED_GCC_FORMULA
OS::LINUX_PREFERRED_GCC_COMPILER_FORMULA
end
end

View File

@ -34,7 +34,7 @@ class DependencyCollector
private
GLIBC = "glibc"
GCC = CompilerSelector.preferred_gcc.freeze
GCC = OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA
sig { void }
def init_global_dep_tree_if_needed!

View File

@ -33,6 +33,7 @@ class Formula
dependency_collector = spec.dependency_collector
related_formula_names = Set.new([
name,
*aliases,
*versioned_formulae_names,
])
[

View File

@ -20,7 +20,8 @@ module Homebrew
].freeze
private_constant :DYNAMIC_LINKERS
GCC_VERSION_SUFFIX = OS::LINUX_GCC_CI_VERSION.delete_suffix(".0").freeze
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
@ -77,10 +78,10 @@ module Homebrew
private_class_method :symlink_ld_so
def symlink_gcc_libs
gcc_opt_prefix = HOMEBREW_PREFIX/"opt/#{OS::LINUX_PREFERRED_GCC_FORMULA}"
gcc_opt_prefix = HOMEBREW_PREFIX/"opt/#{OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA}"
GCC_RUNTIME_LIBS.each do |library|
gcc_library = gcc_opt_prefix/"lib/gcc/#{GCC_VERSION_SUFFIX}/#{library}"
gcc_library = gcc_opt_prefix/"lib/gcc/#{PREFERRED_GCC_RUNTIME_VERSION}/#{library}"
gcc_library_symlink = HOMEBREW_PREFIX/"lib/#{library}"
# Skip if the link target doesn't exist.
next unless gcc_library.readable?

View File

@ -50,7 +50,8 @@ module OS
LINUX_GLIBC_CI_VERSION = "2.35"
LINUX_GLIBC_NEXT_CI_VERSION = "2.35"
LINUX_GCC_CI_VERSION = "11.0"
LINUX_PREFERRED_GCC_FORMULA = "gcc@11"
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
if OS.mac?
require "os/mac"