Brew install git fails

3
我想使用Homebrew来安装Git。我已经从我的iMac上移除了MacPorts。我也完全删除了Homebrew,并重新使用ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"进行安装。
在运行brew doctor后,我不得不删除(只是移动了它们)/usr/local/lib中的一些库。然后我修复了.profile中的$PATH变量,以便/usr/local/bin/usr/local/sbin覆盖了普通的bin目录。
现在我想用brew install git安装Git。它获取了内容,并开始构建Git。但在构建过程中,出现以下错误信息:
~$ brew install git
spo==> Downloading http://git-core.googlecode.com/files/git-1.7.12.4.tar.gz
Already downloaded: /Library/Caches/Homebrew/git-1.7.12.4.tar.gz
==> make prefix=/usr/local/Cellar/git/1.7.12.4 CC=/usr/bin/gcc-4.2 CFLAGS=-Os -w -pipe -march=core2 -msse4.1 -mmacosx-version
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [git-credential-store] Error 1
make: *** Waiting for unfinished jobs....
Writing perl.mak for Git

Error: git did not build
Logs: /Users/23tux/Library/Logs/Homebrew/git/
Help: https://github.com/mxcl/homebrew/wiki/troubleshooting
      https://github.com/mxcl/homebrew/issues/11481
      https://github.com/mxcl/homebrew/issues/14423
      https://github.com/mxcl/homebrew/issues/14585

我查看了 /Users/23tux/Library/Logs/Homebrew/git/ 目录,发现有未定义的符号。以下是输出内容:

/usr/bin/gcc-4.2  -Os -w -pipe -march=core2 -msse4.1 -mmacosx-version-min=10.6 -I. -DPRECOMPOSE_UNICODE -DUSE_ST_TIMESPEC -DNO_GETTEXT  -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'  -DNO_MEMMEM -DSHELL_PATH='"/bin/sh"' -o git-credential-store -L/usr/local/lib  credential-store.o libgit.a xdiff/lib.a  -lz  -liconv  -lcrypto -lssl 
Undefined symbols:
  "_strbuf_addstr_urlencode", referenced from:
      _main in credential-store.o
      _main in credential-store.o
      _main in credential-store.o
      _main in credential-store.o
  "_strbuf_getline", referenced from:
      _parse_credential_file in credential-store.o
  "_strbuf_release", referenced from:
      _parse_credential_file in credential-store.o
      _main in credential-store.o
  "_credential_clear", referenced from:
      _parse_credential_file in credential-store.o
  "_usage_with_options", referenced from:
      _main in credential-store.o
  "_credential_from_url", referenced from:
      _parse_credential_file in credential-store.o
  "_credential_read", referenced from:
      _main in credential-store.o
  "_commit_lock_file", referenced from:
      _rewrite_credential_file in credential-store.o
  "_die_errno", referenced from:
      _parse_credential_file in credential-store.o
      _rewrite_credential_file in credential-store.o
  "_credential_match", referenced from:
      _parse_credential_file in credential-store.o
  "_strbuf_slopbuf", referenced from:
      _parse_credential_file in credential-store.o
      _main in credential-store.o
  "_expand_user_path", referenced from:
      _main in credential-store.o
  "_parse_options", referenced from:
      _main in credential-store.o
  "_write_or_die", referenced from:
      _print_line in credential-store.o
  "_die", referenced from:
      _main in credential-store.o
  "_strbuf_addf", referenced from:
      _main in credential-store.o
  "_hold_lock_file_for_update", referenced from:
      _rewrite_credential_file in credential-store.o
  "_strbuf_grow", referenced from:
      _print_line in credential-store.o
      _main in credential-store.o
      _main in credential-store.o
      _main in credential-store.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [git-credential-store] Error 1
make: *** Waiting for unfinished jobs....
Writing perl.mak for Git

HOMEBREW_VERSION: 0.9.3
HEAD: (none)
CPU: dual-core 64-bit penryn
OS X: 10.6.8-i386
Xcode: 3.2.6
X11: 2.3.6 => /usr/X11

(输出内容很长,我只包含了最后几行出现错误的部分。)
我Google了很多,但没有找到任何解决方案。这是因为MacPorts有些问题吗(我知道它们不喜欢彼此)?或者我该如何修复它?
编辑
我刚刚发现,当我运行 brew doctor 时,我会得到以下输出:
You must: brew install git
You must: brew install git
You must: brew install git
Warning: An outdated version of Git was detected in your PATH.
Git 1.6.6 or newer is required to perform checkouts over HTTP from GitHub.
Please upgrade: brew upgrade git

当我运行brew upgrade git时,出现错误提示:Error: git not installed。我搜索了我的PATH变量,但是找不到任何git二进制文件(或其他内容)。
我认为这意味着在某个地方还有旧的git安装内容,与新的安装发生冲突。我的猜测是否正确?

which git 没有返回结果?Xcode(或者只安装了命令行工具)吗? - Pascal
1
which git 没有返回值,XCode 已安装(版本为 3.2.6)。which gcc 返回 /usr/bin/gcc,而 which g++ 返回 /usr/bin/g++ - 23tux
我发现一些笔记,安装gettext可以解决问题,但不幸的是它并没有解决。 - 23tux
1个回答

2

我无法弄清如何使用Homebrew安装git。因为我不想浪费太多时间,所以我从这里的Rails Installer(http://railsinstaller.org/)安装了整个rvm、ruby、git等内容。然后就可以使用Homebrew了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接