安装ruby-2.1.2:无法加载此类文件-openssl(LoadError) [英] Installing ruby-2.1.2: Cannot load such file -- openssl (LoadError)

查看:408
本文介绍了安装ruby-2.1.2:无法加载此类文件-openssl(LoadError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用rvm安装ruby-2.1.2时得到的错误很少.我是红宝石的新手,因此需要帮助.请让我知道

Getting few errors while installing ruby-2.1.2 using rvm. I am new to ruby and hence need assistance. Please let me know

此处的安装日志和其他相关信息:日志

Installation log and other relevant information here: log

从问题描述中提供的日志中,我在系统中安装了ruby 2.1.2.但是,由于安装错误,尝试使用gem list列出gem时出错,更改为2.1.2即rvm use 2.1.2并执行ruby -r openssl -e 'puts OpensSSL::OPENSSL_VERSION'会出现以下错误:

From the log provided in problem description, I have ruby 2.1.2 installed in the system. However, getting error when tried listing gems with gem list due to installation errors.After changing to 2.1.2 i.e., rvm use 2.1.2 and executing ruby -r openssl -e 'puts OpensSSL::OPENSSL_VERSION' gives this error:

/Users/praveenk.k/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in require':无法加载此类文件- -来自/Users/praveenk.k/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in require'

推荐答案

Ruby< 2.4与OpenSSL 1.1不兼容(例如,请参见

Ruby <2.4 is incompatible with OpenSSL 1.1 (e.g see https://github.com/rbenv/ruby-build/issues/1353).

只是预感,但是如果您使用的是Mac + Homebrew,则最近删除了OpenSSL 1.0,因此brew upgrade openssl中的任何内容都会对其造成破坏.

Just a hunch, but if you're using Mac + Homebrew, OpenSSL 1.0 was recently deleted, so anything along the lines of brew upgrade openssl would trash that.

有几种解决方法:

  1. 我通过与LibreSSL一起安装的asdf具有较旧的红宝石(无论如何,这可能更安全,请参见
  1. I have older Rubies via asdf installed with LibreSSL (which may be safer anyway, see https://security.stackexchange.com/questions/112545/what-are-the-main-advantages-of-using-libressl-in-favor-of-openssl):

$ openssl
OpenSSL> version
LibreSSL 2.8.3

  1. 编译并链接自己的OpenSSL 1.0(或在构建Ruby时将编译器标志设置为环境变量- https://rvm.io/rubies/installing )
  2. 看看您的系统的软件包管理器是否允许您访问openssl 1.0并进行安装(不幸的是,这最近正在帮助一位同事,很抱歉,我们目前无法找到自制酒的好方法)

也许有些事情比这更令人费解了;如果有人有想法,请随时发表评论或提供替代答案.

There might be something less convoluted than that; if someone has ideas, please feel free to comment or give an alternate answer.

编辑

我个人遇到了其他一些软件的问题,并发现此问题已得到解决,因为旧的SSL版本仍然停滞不前:

I personally ran into this issue with some other software and discovered that this fixed it, since the old SSL version was sitting around still:

brew switch openssl 1.0.2s

只要Homebrew不能帮忙"为我清理工作,就应该起作用.

Should work so long as Homebrew doesn't "helpfully" clean that out for me.

这篇关于安装ruby-2.1.2:无法加载此类文件-openssl(LoadError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆