感谢 Lily 的分享。有个打赏功能就更好了。
#1 楼 @i5ting 谢谢 sudo apt-get install zlib1g sudo apt-get install zlib1g.dev
这两个都安装了,再次安装出现以下错误。 gem install rails Building native extensions. This could take a while... ERROR: Error installing rails: ERROR: Failed to build gem native extension.
/home/qdl/.rvm/rubies/ruby-2.2.4/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/qdl/.rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
--help
--clean
/home/qdl/.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/qdl/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:571:in
block in try_compile'
from /home/qdl/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:522:in with_werror'
from /home/qdl/.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/qdl/.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 `
Gem files will remain installed in /home/qdl/.rvm/gems/ruby-2.2.4/gems/nokogiri-1.6.7.1 for inspection. Results logged to /home/qdl/.rvm/gems/ruby-2.2.4/gems/nokogiri-1.6.7.1/ext/nokogiri/gem_make.out
然后根据错误提示,安装: sudo apt-get install build-essential patch sudo apt-get install libgmp-dev
然后再安装:gem install rails rails -v Rails 4.2.5
OK 了,谢谢
收到更新版了。