Merge pull request #13882 from Bo98/gcc-latest-linux
Use GCC 12 for runtime libraries
This commit is contained in:
		
						commit
						65eff656ae
					
				@ -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
 | 
			
		||||
 | 
			
		||||
@ -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!
 | 
			
		||||
 | 
			
		||||
@ -33,6 +33,7 @@ class Formula
 | 
			
		||||
      dependency_collector = spec.dependency_collector
 | 
			
		||||
      related_formula_names = Set.new([
 | 
			
		||||
        name,
 | 
			
		||||
        *aliases,
 | 
			
		||||
        *versioned_formulae_names,
 | 
			
		||||
      ])
 | 
			
		||||
      [
 | 
			
		||||
 | 
			
		||||
@ -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?
 | 
			
		||||
 | 
			
		||||
@ -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"
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user