简体   繁体   English

gem install使用ruby 1.8.7,rbenv和其他本地gem引发分段错误

[英]gem install raises segmentation fault with ruby 1.8.7, rbenv and no other local gems

I've got the old project to maintain on ruby 1.8.7, but I can't install bundle because there's no bundler installed for it currently and trying gem install bundler raises Segmentation fault. 我已经将旧项目维护在ruby 1.8.7上,但是我无法安装bundle,因为目前没有gem install bundler ,尝试使用gem install bundler会引起Segmentation错误。 In fact it doesn't depend on gem, gem install <any gem> has the same result. 实际上,它不依赖于gem, gem install <any gem>具有相同的结果。

A few hours of googling had no effect, so here are the details: 几个小时的谷歌搜索没有效果,因此,以下是详细信息:

$ gem install bundler
/home/marat/.rbenv/versions/1.8.7-p352/lib/ruby/1.8/timeout.rb:60: [BUG] Segmentation fault
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
Aborted

Environment details: 环境详细信息:

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.2
  - RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/marat/.rbenv/versions/1.8.7-p352/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /home/marat/.rbenv/versions/1.8.7-p352/bin/ruby
  - EXECUTABLE DIRECTORY: /home/marat/.rbenv/versions/1.8.7-p352/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/marat/.rbenv/versions/1.8.7-p352/lib/ruby/gems/1.8
     - /home/marat/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

No local gems currently: 当前没有本地宝石:

$ gem list

*** LOCAL GEMS ***

Any ideas? 有任何想法吗?

This is likely an OpenSSL problem. 这可能是OpenSSL问题。 You can run: 您可以运行:

CONFIGURE_OPTS="--with-openssl-dir=/opt/local" rbenv install 1.8.7

This will give you a clean install of Ruby 1.8.7 with the correct OpenSSL information. 这将为您提供带有正确OpenSSL信息的Ruby 1.8.7的全新安装。 You may want to do rbenv uninstall first. 您可能需要rbenv uninstall

Update: 更新:

Another way to tackle this is to change source 'https://rubygems.org' to source 'http://rubygems.org' in your Gemfile. 解决此问题的另一种方法是将Gemfile中的source 'https://rubygems.org'更改为source 'http://rubygems.org'

My guess is that you are trying to install latest version of bundler that does not support ruby 1.8.7(refs here ). 我的猜测是,你要安装最新版本捆绑的不(参考文献支持红宝石1.8.7 这里 )。 Try to install bundler version 1.7.3 or lower. 尝试安装捆绑程序版本1.7.3或更低版本。 Example: gem install bundler -v=1.17.3 示例: gem install bundler -v=1.17.3

Using older version of gcc helped me. 使用旧版本的gcc对我有帮助。 Here're the steps I took to resolve the issue in my case: 以下是我为解决此问题而采取的步骤:

Add repositories containing older versions of gcc for Ubuntu 16.04 and install it: 添加包含适用于Ubuntu 16.04的gcc较旧版本的存储库并进行安装:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt install gcc-4.4

Build project using older gcc: 使用较旧的gcc构建项目:

rbenv uninstall 1.8.7-p352
CC=/usr/bin/gcc-4.4 rbenv install 1.8.7-p352
CC=/usr/bin/gcc-4.4 rbenv local 1.8.7-p352

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM