2011-06-07 120 views
3

我已经搜索了这个问题,并一直在寻找与PC相关的资源。每次我尝试安装EventMachine的宝石,我得到这个错误:无法在mac osx雪豹上安装eventmachine

Building native extensions. This could take a while... ERROR: Error installing eventmachine: ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb checking for rb_trap_immediate in ruby.h,rubysig.h... * extconf.rb failed * Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/local/bin/ruby /usr/local/lib/ruby/1.9.1/mkmf.rb:368:in try_do': The complier failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/local/lib/ruby/1.9.1/mkmf.rb:446:in try_compile' from /usr/local/lib/ruby/1.9.1/mkmf.rb:568:in try_var' from /usr/local/lib/ruby/1.9.1/mkmf.rb:816:in block in have_var' from /usr/local/lib/ruby/1.9.1/mkmf.rb:693:in block in checking_for' from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in block (2 levels) in postpone' from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in open' from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in block in postpone' from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in open' from /usr/local/lib/ruby/1.9.1/mkmf.rb:276:in postpone' from /usr/local/lib/ruby/1.9.1/mkmf.rb:692:in checking_for' from /usr/local/lib/ruby/1.9.1/mkmf.rb:815:in have_var' from extconf.rb:16:in `'

Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10 for inspection. Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/ext/gem_make.out

这似乎在构建C扩展打破,我已经试过像this one,但没有运气的各种解决方案。

+0

你是怎么安装ruby的? – Schmurfy 2011-06-18 17:03:11

+0

我在安装XCode 3.2.6时遇到同样的问题。 – jm3 2011-10-10 03:56:42

回答

0

您需要安装XCode 3.2或4才能编译扩展。 XCode软件包是可选的安装软件,可以安装在操作系统零售包的主要安装DVD上,也可以作为新系统的补充光盘。

您可以从App Store下载10.7或更高版本。

+1

我有3.2安装,它仍然无法正常工作。 – colourandcode 2011-06-07 20:21:39

+0

我也知道我的g ++是最新的并且正在工作 – colourandcode 2011-06-07 20:22:04

+1

这个编译问题是否与eventmachine隔离? – tadman 2011-06-07 21:12:31

0

您的问题可能是因为您尚未安装Xcode 4.2/4.3的开发工具。

在Xcode 4.2.x版和4.3.x版,您需要单独安装的命令行工具,通过以下几个方向:从“Xcode的”项目的菜单 栏上

  1. 启动Xcode中打开“首选项” 。
  2. 选择“下载”选项卡(图标)。对于“命令行工具”(方向来自我朋友的网站 这里借用)

如果安装正确,那么CC --version应该发出

  • 单击“安装”按钮:

    %CC - 版本

    Apple clang version 3.1 (tags/Apple/clang-318.0.54) (based on LLVM 3.1svn) 
    Target: x86_64-apple-darwin11.3.0 
    Thread model: posix 
    

    OR

    如果您在使用Ruby 1.9.3,存在的一些已知问题EventMachine的。请参阅http://isitruby19.com/eventmachine。对于需要使用RVM或rbenv的eventmachine的项目,我建议您降级到1.9.2。

  • +0

    我安装了开发者工具('Apple LLVM 4.2版(clang-425.0.28)(基于LLVM 3。2svn)'),但它并没有改变错误。 – 2013-04-16 15:56:00

    +0

    同样在这里,我有这个东西,它仍然不会工作。 – sergserg 2015-04-16 01:47:43

    0

    安装的命令行工具,我有同样的问题。打开mkmf.log文件并运行命令将问题缩小到gmp库。 gmp库位于不同的目录中,并且未设置LD_LIBRARY_PATH。因此,我将LD_LIBRARY_PATH设置为gmp存在的位置,然后正确安装。