无法使用Xcode 4.3安装autotest-fsevent gem

4

我在升级到Xcode 4.3后(删除了旧版本的Xcode)无法安装autotest-fsevent gem。通过“首选项”>“下载”>“组件”选项卡安装了命令行工具。

操作系统为osx 10.7.3,rvm版本为1.10.2,ruby版本为1.9.3-rc1,bundler版本为1.0.22。

$ bundle

Installing autotest-fsevent (0.2.7) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/doc/.rvm/rubies/ruby-1.9.3-rc1/bin/ruby extconf.rb 
extconf.rb:36:in `<main>': Xcode not found - see README for assistance (RuntimeError)


Gem files will remain installed in /Users/doc/.rvm/gems/ruby-1.9.3-rc1@global/gems/autotest-fsevent-0.2.7 for inspection.
Results logged to /Users/doc/.rvm/gems/ruby-1.9.3-rc1@global/gems/autotest-fsevent-0.2.7/ext/fsevent/gem_make.out
An error occured while installing autotest-fsevent (0.2.7), and Bundler cannot continue.
Make sure that `gem install autotest-fsevent -v '0.2.7'` succeeds before bundling.

README文件中只是简单说明需要使用Xcode。

我已经选择了正确的Xcode.app:

$ xcode-select -print-path
/Applications/Xcode.app/Contents/Developer

还有其他人遇到这个问题吗?有什么办法可以解决吗?

1个回答

7

原来gem文件中Xcode的路径是硬编码进去的:

ext/fsevent/extconf.rb:

...
  elsif File.exists?('/Developer/Applications/Xcode.app')
    `CFLAGS='-isysroot /Developer/SDKs/MacOSX#{SDK_VERSION}.sdk -mmacosx-version-min=#{SDK_VERSION}' /usr/bin/gcc -framework CoreServices -o "#{GEM_ROOT}/bin/fsevent_sleep" fsevent_sleep.c`
    raise "\e[1;31mCompilation of fsevent_sleep binary failed - see README for assistance\e[0m" unless File.executable?("#{GEM_ROOT}/bin/fsevent_sleep")
...

Xcode 4.3现在已经作为一个应用程序安装在 /Applications 中。另一位 Github 用户 (fxposter) 发现了同样的问题,并在我之前几个小时就提出了一个pull request。建议的更改已经合并到 gem 中,v0.2.8 已经发布。


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