ERROR: Error installing rails: ERROR: Failed to build gem native extension.

问题描述:
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.


    /home/gubobo/.rvm/rubies/ruby-2.1.7/bin/ruby 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/gubobo/.rvm/rubies/ruby-2.1.7/bin/ruby
--help
--clean
/home/gubobo/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.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/gubobo/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/mkmf.rb:571:in `block in try_compile'
from /home/gubobo/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/mkmf.rb:522:in `with_werror'
from /home/gubobo/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.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/gubobo/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/mkmf.rb:619:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:336:in `
'




大概就是缺少什么工具






解决办法:sudo apt-get install libgmp-dev or sudo apt-get install libgmp3-dev
链接:http://stackoverflow.com/questions/29317640/gem-install-rails-fails-on-ubuntu


http://ruby-on-rails-eq8.blogspot.co.uk/2015/10/solving-ubuntu-1404-ruby-c-dependancy.html

你可能感兴趣的:(ruby)