2016-02-26 148 views
-4
Building native extensions. This could take a while... 
ERROR: Error installing rails: 
    ERROR: Failed to build gem native extension. 

    current directory: /home/nagaraju/.rvm/gems/[email protected]/gems/nokogiri-1.6.7.2/ext/nokogiri 
/home/nagaraju/.rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160226-5567-umlwr8.rb extconf.rb 
checking if the C compiler accepts ... *** 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=/home/nagaraju/.rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME) 
    --help 
    --clean 
/home/nagaraju/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) 
You have to install development tools first. 
    from /home/nagaraju/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile' 
    from /home/nagaraju/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror' 
    from /home/nagaraju/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile' 
    from extconf.rb:80:in `nokogiri_try_compile' 
    from extconf.rb:87:in `block in add_cflags' 
    from /home/nagaraju/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags' 
    from extconf.rb:86:in `add_cflags' 
    from extconf.rb:336:in `<main>' 

To see why this extension failed to compile, please check the mkmf.log which can be found here: 

    /home/nagaraju/.rvm/gems/[email protected]/extensions/x86_64-linux/2.2.0/nokogiri-1.6.7.2/mkmf.log 

extconf failed, exit code 1 

Gem files will remain installed in /home/nagaraju/.rvm/gems/[email protected]/gems/nokogiri-1.6.7.2 for inspection. 
Results logged to /home/nagaraju/.rvm/gems/[email protected]/extensions/x86_64-linux/2.2.0/nokogiri-1.6.7.2/gem_make.out 
+0

如果您仔細閱讀錯誤消息,您將確切知道該怎麼做。提示:「你必須先安裝開發工具。」 – MarsAtomic

回答

1

正如評論中所述,您必須先安裝開發人員工具。這是一個簡單的命令在終端:

xcode-select --install 

安裝完成後。嘗試安裝rails

讓我們知道,否則。