为什么Homebrew报告“无法理解kern.osversion`14.0.0'”?

时间:2015-01-21 13:24:57

标签: xcode gcc command-line homebrew llvm-gcc

当我运行brew -- config时,我得到了

HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: bc071fb5448628aea8f066bbc0f37b0ecb4f11ee
Last commit: 16 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit haswell
OS X: 10.10.1-x86_64
Xcode: 6.1.1
CLT: 6.1.1.0.1.1416017670
couldn't understand kern.osversion `14.0.0'
GCC-4.2: build 5666
Clang: 6.0 build 600
X11: 2.7.7 => /opt/X11
System Ruby: 2.0.0-p481
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby

即使我的Xcode(在优胜美地)命令行工具似乎是最新的(以确保我重新运行xcode-select --install)并且在正确的位置

/Applications/Xcode.app/Contents/Developer 

根据xcode-select -print-path,我(仅)gcc

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

根据brew doctor的唯一问题是

Unexpected static libraries:
    /usr/local/lib/libtclstub8.6.a
    /usr/local/lib/libtkstub8.6.a

但是我有几个可疑的东西,特别是usr/bin/gcc-4.2--version给出了

couldn't understand kern.osversion `14.0.0'
i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
...

/usr/bin/i686-apple-darwin11-gcc-4.2.1--version也提供了

couldn't understand kern.osversion `14.0.0'
i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)    
...

brew -- config的报告

是什么
  

无法理解kern.osversion`14.0.0'

意思?有什么我应该做的吗?

1 个答案:

答案 0 :(得分:3)

你刚才在这台机器上升级了OS X吗?我猜它们来自旧版的装置。由于默认情况下未安装gcc,因此操作系统升级可能不会删除或替换gcc和其他XCode命令行工具。你是否可以真正安全地删除它们,我不知道,但显而易见的是重命名它们(或将它们移动到备份子目录中),以便它们不在你的PATH之内。这样,自制软件将找不到它们并使用较新的编译器(clang)。很可能,您的系统(XCode,brew)将照常继续,因为他们将使用您系统上的clang

你看到的错误,“无法理解kern.osversion '14 .0.0'”,可能是因为这个gcc是针对较旧的OS X内核版本编译的,而且是当前版本( Yosemite / 14.0.0)向后与此不相容。

我不知道确切地安装了哪些编译器工具,但对于有问题的gcc,您可以执行以下操作:

mv /usr/bin/gcc-4.2 /usr/bin/gcc-4.2-oldOSX10.9

(假设这是安装在10.9;可能是早期版本)。

有点不幸的是,升级XCode(或者更确切地说,是一个全新的版本)不会检查旧版本的命令行工具并删除那些(*)。虽然可以理解,Apple当然假设您不使用普通XCode工具之外的任何东西;他们显然不会以这种方式支持自制软件。

(*)也许确实如此,但是如果你跳过一个版本或者2版本,它可能不会回溯到检查旧版本的时间。