Permalink
Browse files

Fixed an error where `gcc` was available, but brew failed because it …

…has checked for XCode presence

The error was: "undefined method `<' for nil:NilClass", coming from Library/Homebrew/extend/ENV.rb:140

This prevented installing for users who have downloaded "standalone" compilers
eg. from <https://github.com/kennethreitz/osx-gcc-installer>.
  • Loading branch information...
karmi committed Sep 2, 2011
1 parent 3f4ef7e commit 64ad3d23fd1bff291a567f7d94f441a64017a961
Showing with 7 additions and 5 deletions.
  1. +2 −0 Library/Homebrew/cmd/doctor.rb
  2. +5 −5 Library/Homebrew/extend/ENV.rb
@@ -195,6 +195,8 @@ def check_gcc_versions
end
if MacOS.xcode_version == nil
+ # TODO: Do better detection of gcc etc., or display proper instructions for
+ # installing eg. <https://github.com/kennethreitz/osx-gcc-installer>
puts <<-EOS.undent
We couldn't detect any version of Xcode.
If you downloaded Xcode 4.1 from the App Store, you may need to run the installer.
@@ -120,10 +120,10 @@ def gcc_4_0_1
alias_method :gcc_4_0, :gcc_4_0_1
def gcc
- if MacOS.xcode_version < '4'
+ if MacOS.xcode_version.to_s < '4'
self['CC'] = '/usr/bin/cc'
self['CXX'] = '/usr/bin/c++'
- elsif MacOS.xcode_version >= '4.2'
+ elsif MacOS.xcode_version.to_s >= '4.2'
# Apple stopped adding the -4.2 suffixes
self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/gcc"
self['CXX'] = "#{MacOS.xcode_prefix}/usr/bin/g++"
@@ -137,9 +137,9 @@ def gcc
alias_method :gcc_4_2, :gcc
def llvm
- if MacOS.xcode_version < '4'
+ if MacOS.xcode_version.to_s < '4'
self.gcc
- elsif MacOS.xcode_version < '4.1'
+ elsif MacOS.xcode_version.to_s < '4.1'
self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/llvm-gcc"
self['CXX'] = "#{MacOS.xcode_prefix}/usr/bin/llvm-g++"
else
@@ -149,7 +149,7 @@ def llvm
end
def clang
- if MacOS.xcode_version > '4'
+ if MacOS.xcode_version.to_s > '4'
self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/clang"
self['CXX'] = "#{MacOS.xcode_prefix}/usr/bin/clang++"
else

0 comments on commit 64ad3d2

Please sign in to comment.