From a62c16e77f7387761a61ccf6abdbd1da31abbad1 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Mon, 9 Aug 2010 21:06:33 -0700 Subject: [PATCH] brew doctor - add check for /usr/bin/cc symlinks. If you symlink /usr/bin/cc to llvm, then Homebrew's "fails_with_llvm" checks are bypassed. So add a warning to "brew doctor". --- Library/Homebrew/brew_doctor.rb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/brew_doctor.rb b/Library/Homebrew/brew_doctor.rb index fddd33a443..fa86dba5d0 100644 --- a/Library/Homebrew/brew_doctor.rb +++ b/Library/Homebrew/brew_doctor.rb @@ -98,7 +98,7 @@ def check_gcc_versions if gcc_42 == nil puts <<-EOS.undent - We couldn't detect gcc 4.2.x. Some formulas require this compiler. + We couldn't detect gcc 4.2.x. Some formulae require this compiler. EOS elsif gcc_42 < RECOMMENDED_GCC_42 @@ -111,7 +111,7 @@ def check_gcc_versions if gcc_40 == nil puts <<-EOS.undent - We couldn't detect gcc 4.0.x. Some formulas require this compiler. + We couldn't detect gcc 4.0.x. Some formulae require this compiler. EOS elsif gcc_40 < RECOMMENDED_GCC_40 @@ -123,6 +123,21 @@ def check_gcc_versions end end +def check_cc_symlink + which_cc = Pathname.new('/usr/bin/cc').realpath.basename.to_s + if which_cc == "llvm-gcc-4.2" + puts <<-EOS.undent + You changed your cc to symlink to llvm. + This bypasses LLVM checks, and some formulae may mysteriously fail to work. + You may want to change /usr/bin/cc to point back at gcc. + + To force Homebrew to use LLVM, you can set the "HOMEBREW_LLVM" environmental + variable, or pass "--use-lvm" to "brew install". + + EOS + end +end + def __check_subdir_access base target = HOMEBREW_PREFIX+base return unless target.exist? @@ -427,6 +442,7 @@ def brew_doctor check_homebrew_prefix check_for_stray_dylibs check_gcc_versions + check_cc_symlink check_for_other_package_managers check_for_x11 check_for_nonstandard_x11