From 4dc1a7bdce4d2b311c2ca2507ecdd5654a813f2b Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Sun, 8 Apr 2012 11:10:22 -0500 Subject: brew doctor: add check for outdated compilers A common source of build problems on Xcode 4.3+ is outdated compilers, usually when a user has installed over top of an old version and hasn't installed the CLT. Since the compilers from the previous Xcode are still around, brew doctor wouldn't complain. This adds a hash containing a list of the canonical compiler versions for supported versions of Xcode, and adds a check against that to determine whether a given installation has any compilers which are out of date. Closes Homebrew/homebrew#11518. Signed-off-by: Misty De Meo --- Library/Homebrew/cmd/doctor.rb | 11 +++++++++++ Library/Homebrew/utils.rb | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'Library') diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 3a47b7133..bef15afff 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -232,6 +232,17 @@ def check_cc end end +def check_standard_compilers + return if check_for_latest_xcode # only check if Xcode is up to date + if !MacOS.compilers_standard? then <<-EOS.undent + Your compilers are different from the standard versions for your Xcode. + If you have Xcode 4.3 or newer, you should install the Command Line Tools for + Xcode from within Xcode's Download preferences. + Otherwise, you should reinstall Xcode. + EOS + end +end + def __check_subdir_access base target = HOMEBREW_PREFIX+base return unless target.exist? diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index d041194ec..d7e28fd31 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -521,6 +521,25 @@ module MacOS extend self def prefer_64_bit? Hardware.is_64_bit? and not leopard? end + + StandardCompilers = { + "3.1.4" => {:gcc_40_build_version=>5493, :gcc_42_build_version=>5577, :llvm_build_version=>2064}, + "3.2.6" => {:gcc_40_build_version=>5494, :gcc_42_build_version=>5666, :llvm_build_version=>2335, :clang_version=>"1.7", :clang_build_version=>77}, + "4.0.0" => {:gcc_40_build_version=>5494, :gcc_42_build_version=>5666, :llvm_build_version=>2335, :clang_version=>"2.0", :clang_build_version=>137}, + "4.0.1" => {:gcc_40_build_version=>5494, :gcc_42_build_version=>5666, :llvm_build_version=>2335, :clang_version=>"2.0", :clang_build_version=>137}, + "4.0.2" => {:gcc_40_build_version=>5494, :gcc_42_build_version=>5666, :llvm_build_version=>2335, :clang_version=>"2.0", :clang_build_version=>137}, + "4.2.0" => {:llvm_build_version=>2336, :clang_version=>"3.0", :clang_build_version=>211}, + "4.3.0" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318}, + "4.3.1" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318}, + "4.3.2" => {:llvm_build_version=>2336, :clang_version=>"3.1", :clang_build_version=>318} + } + + def compilers_standard? + xcode = MacOS.xcode_version + return unless StandardCompilers.keys.include? xcode + + StandardCompilers[xcode].all? {|k,v| MacOS.send(k) == v} + end end module GitHub extend self -- cgit v1.2.3