繁体   English   中英

错误:extconf失败,退出代码1 [Ruby on Rails]

[英]Error: extconf failed, exit code 1 [Ruby on Rails]

尝试安装devise gem时出错。 在我的宝石列表中添加了宝石“ devise”,“〜> 3.2.2”,并进入终端以执行以下操作:

Steven-Lims-MacBook-Pro:Pinteresting stevenlim$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.4)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.2)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.2)
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.2)
Using activemodel (4.0.2)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.1)
Using activerecord (4.0.2)

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb 
checking for ruby/util.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/rvm/rubies/ruby-2.0.0-p353/bin/ruby
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:565:in `try_cpp'
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
    from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
    from extconf.rb:14:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p353/gems/bcrypt-ruby-3.1.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.0.0-p353/extensions/x86_64-darwin-10/2.0.0/bcrypt-ruby-3.1.2/gem_make.out
An error occurred while installing bcrypt-ruby (3.1.2), and Bundler cannot
continue.
Make sure that `gem install bcrypt-ruby -v '3.1.2'` succeeds before bundling.

编程新手,Ruby on Rails可以为您提供帮助。 谢谢!

设法解决了这个问题。 我最近升级到了OS Mavericks,出现了问题。

尝试在终端安装gem gem来安装bcrypt-ruby -v'3.1.2',但是遇到了同样的问题。

此后,因为在终端上运行Xcode-select --install也失败而无法在App Store上安装Xcode(找不到程序)。

因此,我偶然遇到了这个线程,并按照建议在终端中运行sudo ln -s / usr / bin / llvm-gcc /usr/bin/gcc-4.2。

线程: gem install pg在OSX Lion上不起作用

此后,我运行了gem install bcrypt-ruby -v'3.1.2'并将软件包安装在终端中,目前一切正常。 希望这行得通。 其实我不知道我在做什么,但希望它能起作用。 有人可以启发我实际上在做什么吗?

在将OS X Mavericks更新到10.9.5后也遇到了此问题,该更新也更新了Xcode(版本6.0.1(6A317))。

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/e/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb 
    creating Makefile
    Compiling v8 for x64
    Using python 2.7.5
    Unable to find a compiler officially supported by v8.
    It is recommended to use GCC v4.4 or higher
    Using compiler: /usr/bin/c++ (c++ version ) 

    extconf failed, exit code 1

    Gem files will remain installed in /Users/e/.rvm/gems/ruby-2.1.1/gems/libv8-3.16.14.7 for inspection.
    Results logged to /Users/e/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-12/2.1.0-static/libv8-3.16.14.7/gem_make.out

    An error occurred while installing libv8 (3.16.14.7), and Bundler cannot continue.
    Make sure that `gem install libv8 -v '3.16.14.7'` succeeds before bundling.

解决:必须接受并完成Xcode的安装才能完成捆绑包更新。

完成Xcode的安装后,捆绑更新完成,没有问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM