[英]gem install rails build error failed to build gem native extension
[英]Trying to install rails on xubuntu 14.04 ERROR: Failed to build gem native extension
gem install rails 對我不起作用。 我從這個站點http://installfest.railsbridge.org/installfest/linux (當然是最新版本)一步一步地做了所有事情,然后我卸載了 ruby、ruby gems、rvm 並從這個站點做了所有事情https://gorails .com/setup/ubuntu/14.04也不起作用。 我看過許多相關主題並嘗試了許多解決方案,但似乎沒有任何效果對我有用。 我試過ruby-dev,ruby-all-dev,重新安裝ruby,我確定我已經安裝了,rvm要求。 我找不到任何可以解決問題的東西,所以希望你們能幫助我。
emil@emil-AO725:~$ gem install rails -v 4.2.4
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: minitest-5.8.0.gem (100%)
Successfully installed minitest-5.8.0
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: activesupport-4.2.4.gem (100%)
Successfully installed activesupport-4.2.4
Fetching: rails-deprecated_sanitizer-1.0.3.gem (100%)
Successfully installed rails-deprecated_sanitizer-1.0.3
Fetching: mini_portile-0.6.2.gem (100%)
Successfully installed mini_portile-0.6.2
Fetching: nokogiri-1.6.6.2.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/home/emil/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20150905-28115-dnm7rt.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/emil/.rvm/rubies/ruby-2.2.3/bin/$(RUBY_BASE_NAME)
--help
--clean
/home/emil/.rvm/rubies/ruby-2.2.3/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/emil/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
from /home/emil/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
from /home/emil/.rvm/rubies/ruby-2.2.3/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/emil/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:337:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /home/emil/.rvm/gems/ruby-2.2.3/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /home/emil/.rvm/gems/ruby-2.2.3/extensions/x86_64-linux/2.2.0/nokogiri-1.6.6.2/gem_make.out
如果您使用的是 ruby 版本管理器,請嘗試切換到 ruby 2.2.2 。 並再次嘗試安裝 gems。 我遇到了同樣的問題,我通過切換到 ruby 2.2.2 成功安裝了我的 gem。 也許它是 ruby 2.2.3 的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.