Persistent Ruby segfaulting after a clean install

橙三吉。 提交于 2020-01-13 14:05:21

问题


Ruby keeps segfaulting when using the Koala gem to talk over HTTP:

/Users/pawel/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799: [BUG] Segmentation fault

I've tried the following:

  • Run which -a ruby which showed multiple Rubies via MacPorts. So I deleted those and running the same command again returns only /usr/bin/ruby
  • I've removed the MacPorts version of PostgreSQL and installed it with Homebrew instead (With MacPorts, it installs its own version of OpenSSL)
  • Running openssl version returns OpenSSL 1.0.0g 18 Jan 2012
  • I removed Ruby 1.9.3 from RVM and tried Luciano's method below which didn't work.
  • I've also tried reinstalling 1.9.3 from RVM and specifying --with-openssl-dir=/opt/local since which openssl returns /opt/local/bin/openssl
  • I've reinstalled RVM (It's now version 1.10.2 in /Users/pawel/.rvm/bin/rvm)
  • I've upgraded to Ruby 1.9.3-p125 and have also tried on 1.9.2
  • I've followed the instructions here: http://www.christopherirish.com/2011/09/02/ruby-1-9-2-segmentation-fault-and-openssl/ (which are my above steps, actually). I've also read Christopher's previous post here.
  • In my project directory when I run the following then I get the expected 0.:

    ruby -rubygems -e" require 'eventmachine'; require 'openssl' "; echo $?

  • I've tried to sudo port -f deactivate openssl but then when I try to start a Rails server I get Library not loaded: /opt/local/lib/libssl.1.0.0.dylib

I need some more ideas on what else I can try, or things I've missed.


回答1:


I'm also getting this same Segmentation Fault error, but I'm trying to list files on AWS-S3.

Edit:

This way worked for me:

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:$HOME/.rvm/bin
rvm remove 1.9.3 
rvm pkg install iconv
rvm pkg install openssl
rvm install ruby-1.9.3 --with-openssl-dir=~/.rvm/usr --with-iconv-dir=~/.rvm/usr
  • as @Simpleton said, I wrote a comment in the wrong place. Now I'm editing it with a response. ;-)



回答2:


The problem seemed to be that Homebrew and MacPorts were conflicting, so I deleted MacPorts, removed all packages and the /opt/local/ directory. This caused some issue with the PG gem due to the PostgreSQL installation on Homebrew.

So I deleted the Postgres formula, then reinstalled it and ditto for the OpenSSL installation using Homebrew.

After that I imploded RVM and installed it and my Rubies again (not sure if this step was necessary) and finally it works.




回答3:


I ran into this issue, too, but used a different solution. Here's the full stack trace of the error.

Here is the official bug report: http://bugs.ruby-lang.org/issues/6184 The responses below the stack trace were very helpful.

If you're using OS X's default openssl -> do like brew install openssl and build with installed openssl, then try again.

If you're using openssl that installed by user -> build with OS X default ssl and try again.

This sounded similar to an issue for me recently when the readline library installed in MacPorts broke a ruby installation. Running the following script on the broken ruby installation showed it was loading the MacPorts openssl lib

require 'net/https'
puts `lsof -p #{$$} | grep ssl | awk '{print $9}'`

(the output)

/Users/john/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/x86_64-darwin11.2.0/openssl.bundle
/opt/local/lib/libssl.1.0.0.dylib

The solution was to temporarily move MacPorts out of /opt/local while installing ruby.

  1. Quit all processes that are accessing MacPorts files. You can see which ones are running with sudo lsof | grep /opt/local.
  2. sudo mv /opt/local /opt/localbak
  3. Open a new terminal, then compile and install Ruby
  4. sudo mv /opt/localbak /opt/local

After that, the ruby installation worked properly alongside MacPorts and did not load the libssl file from MacPorts.



来源:https://stackoverflow.com/questions/9000262/persistent-ruby-segfaulting-after-a-clean-install

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!