首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装Rails时出现"extconf.rb failed“消息

安装Rails时出现"extconf.rb failed“消息
EN

Stack Overflow用户
提问于 2013-08-02 03:05:59
回答 1查看 4.5K关注 0票数 4

新手来了。我已经在网站上搜索了其他类似的问题,但仍然无法解决这个问题。我已经安装了Ruby2.0.0和RubyGem 2.0.3,但是当我尝试安装Rails 4.0.0时,我得到了:

代码语言:javascript
复制
    Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.
    /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
*** 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
    --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=/Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
    --with-atomic_reference-dir
    --without-atomic_reference-dir
    --with-atomic_reference-include
    --without-atomic_reference-include=${atomic_reference-dir}/include
    --with-atomic_reference-lib
    --without-atomic_reference-lib=${atomic_reference-dir}/
/Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
    from /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:814:in `try_run'
    from extconf.rb:22:in `<main>'


Gem files will remain installed in /Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0/gems/atomic-1.1.10 for inspection.
Results logged to /Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0/gems/atomic-1.1.10/ext/gem_make.out

我尝试通过以下方式安装Rails

代码语言:javascript
复制
gem install rails --version 4.0.0

我不确定设置是否有问题,或者我是否仍然需要安装某些东西。提前感谢您的帮助。

EN

回答 1

Stack Overflow用户

发布于 2013-08-02 03:45:54

看起来你在使用OSX。

当你不能编译一些扩展时,就会出现这个错误,在这种情况下,是因为缺少编译器(“你必须先安装开发工具”)。打开应用商店,下载XCode,安装后,点击菜单上的"XCode“,进入Preferences -> Downloads -> Components并下载”命令行工具“。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18002454

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档