簡體   English   中英

錯誤:無法生成gem本機擴展。 嘗試安裝滑軌時

[英]ERROR: Failed to build gem native extension. when trying to install rails

SYS:Ubuntu 14.04 Ruby版本:ruby 2.2.3p173(2015-08-18修訂版51636)[x86_64-linux] Gem版本:2.4.8

我不能說我在滑軌方面有豐富的經驗,但是當我嘗試在新計算機上部署滑軌時,我什至無法安裝滑軌。 這是gem_make.out文件
/usr/local/bin/ruby -r ./siteconf20151030-11581-1f0cbp1.rb extconf.rb checking if the C compiler accepts ... yes Building nokogiri using packaged libraries. * 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/bin/$(RUBY_BASE_NAME) --help --clean --use-system-libraries /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- openssl (LoadError) from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require' from /usr/local/lib/ruby/2.2.0/net/https.rb:22:in <top (required)>' from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require' from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require' from /usr/local/lib/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:3:in ' from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in require' from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in rescue in require' from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in require' from extconf.rb:395:in '

extconf failed, exit code 1由於在make時無法使用Openssl,因此將https源替換為http。 有什么建議么?

請嘗試以下操作以確保您具有必需的庫:

sudo apt-get install ruby-dev zlib1g-dev libgmp-dev libxml2-dev libssl-dev openssl

是的,我找到了解決方法,這是基於@matanco的解決方案的,他的解決方案還不完整
sudo apt-get install ruby-dev zlib1g-dev libgmp-dev libxml2-dev libssl-dev openssl
執行完此命令后,應再次編譯Ruby安裝sudo sh ./configure
sudo make
sudo make install
sudo sh ./configure
sudo make
sudo make install

Ruby代碼需要構建ssl本機庫和標頭。

這樣可以解決你的問題

sudo apt-get install libssl-dev

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM