全新安装后持续出现 Ruby 段错误

发布于 2024-12-28 18:03:09 字数 1513 浏览 2 评论 0原文

当使用 Koala gem 通过 HTTP 进行通信时,Ruby 不断出现段错误:

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

我尝试了以下操作:

  • 运行 which -a ruby​​ ,它通过 MacPorts 显示了多个 Ruby。所以我删除了这些并再次运行相同的命令仅返回 /usr/bin/ruby
  • 我已经删除了 PostgreSQL 的 MacPorts 版本并使用 Homebrew 安装了它(对于 MacPorts,它安装了自己的 PostgreSQL 版本) OpenSSL)
  • 运行 openssl version 返回 OpenSSL 1.0.0g 18 Jan 2012
  • 我从 RVM 中删除了 Ruby 1.9.3 并尝试卢西亚诺的以下方法不起作用。
  • 我还尝试从 RVM 重新安装 1.9.3 并指定 --with-openssl-dir=/opt/local 因为 which openssl 返回 /opt/local /bin/openssl
  • 了 RVM(现在是 /Users/pawel/.rvm/bin/rvm 中的版本 1.10.2)
  • 我已经重新安装 升级到 Ruby 1.9.3-p125 并尝试了 1.9.2
  • 我已按照此处的说明进行操作: http://www.christopherirish.com/2011/09/02/ruby-1-9-2-segmentation-fault-and-openssl/ (这是我上面的步骤,实际上)。我还读过克里斯托弗的上一篇文章 在这里
  • 在我的项目目录中,当我运行以下命令时,我得到了预期的 0.:

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

  • 我尝试过 sudo port -f deactivate openssl 但当我尝试启动 Rails 服务器时,我得到 Library not returned: /opt/local/lib /libssl.1.0.0.dylib

我需要更多关于我还可以尝试什么或我错过的事情的想法。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

末骤雨初歇 2025-01-04 18:03:09

我也遇到了同样的分段错误错误,但我正在尝试列出 AWS-S3 上的文件。

编辑

这种方式对我有用:

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
  • 正如@Simpleton所说,我在错误的地方写了一条评论。现在我正在编辑它并做出回应。 ;-)

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. ;-)
—━☆沉默づ 2025-01-04 18:03:09

问题似乎是 Homebrew 和 MacPorts 冲突,所以我删除了 MacPorts,删除了所有包和 /opt/local/ 目录。由于 Homebrew 上安装了 PostgreSQL,这导致 PG gem 出现一些问题。

所以我删除了 Postgres 公式,然后重新安装它,并使用 Homebrew 进行 OpenSSL 安装。

之后,我内爆了 RVM 并再次安装了它和我的红宝石(不确定这一步是否必要),最后它起作用了。

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.

不必你懂 2025-01-04 18:03:09

我也遇到了这个问题,但使用了不同的解决方案。这是错误的完整堆栈跟踪

这是官方错误报告: http://bugs.ruby-lang.org/issues/6184 堆栈跟踪下面的响应非常有帮助。

如果您使用 OS X 的默认 openssl ->就像 brew install 一样
openssl
并使用已安装的 openssl 进行构建,然后重试。

如果您使用的是用户安装的 openssl ->使用 OS X 默认 ssl 构建并重试。

这听起来类似于我最近遇到的一个问题,当 MacPorts 中安装的 readline 库破坏了 ruby​​ 安装。在损坏的 ruby​​ 安装上运行以下脚本显示它正在加载 MacPorts openssl lib

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

(输出)。

/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

解决方案是在安装 ruby​​ 时暂时将 MacPorts 从 /opt/local 移出。

  1. 退出所有正在访问 MacPorts 文件的进程。您可以使用 sudo lsof | 查看哪些正在运行。 grep /opt/local.
  2. sudo mv /opt/local /opt/localbak
  3. 打开一个新终端,然后编译安装 Ruby
  4. sudo mv /opt/localbak /opt/local

之后,ruby 安装与 MacPorts 一起正常工作,并且没有从 MacPorts 加载 libssl 文件。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文