加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 安装Rails时出现“extconf.rb failed”消息

发布时间:2020-12-17 02:05:00 所属栏目:百科 来源:网络整理
导读:新手在这里.我在网站上搜索了其他类似的问题,但仍然无法解决问题.我已经安装了 Ruby 2.0.0和 RubyGem 2.0.3,但是当我尝试安装Rails 4.0.0时,我得到了: Building native extensions. This could take a while...ERROR: Error installing rails: ERROR: Faile
新手在这里.我在网站上搜索了其他类似的问题,但仍然无法解决问题.我已经安装了 Ruby 2.0.0和 RubyGem 2.0.3,但是当我尝试安装Rails 4.0.0时,我得到了:

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

gem install rails --version 4.0.0

我不确定设置是否有问题,或者我是否还需要安装.在此先感谢您的帮助.

解决方法

看来你正在使用OSX.

当您无法编译某些扩展时会发生此错误,在这种情况下由于缺少编译器(“您必须首先安装开发工具”).打开App Store,下载XCode,安装完成后,点击菜单上的“XCode”,进入首选项 – >下载 – >组件并下载“命令行工具”.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读