在使用rvm在ubuntu 22.04上安装ruby时存在问题,会出现以下错误
。
如果我尝试安装Ruby 2.7.0、2.7.1、2.7.2及更高版本,就会出现相同的错误。
我在这里找到了建议here,建议使用以下步骤:
rvm pkg install openssl
rvm remove x.x.x
rvm install x.x.x -C --with-openssl-dir=$HOME/.rvm/usr 这样安装成功了,但是一些库(如pg、rails或puma)不能与以这种方式安装的Ruby版本一起使用。例如,在bundle install之后,如果运行“rails db:migrate”命令,它将从pg gem给出另一个错误-Segmentation fault。
根据这篇文章在此输入链接描述, pg gem 的问题也与 OpenSSL 版本有关。因此,这两个问题都与 Ubuntu 22.04 自带的 OpenSSL 版本有关,但我找不到任何指南,逐步说明如何修复它或如何使用旧的 OpenSSL 版本进行 Ruby 安装,以避免所有这些错误。那么,在 Ubuntu 22.04 上安装 Ruby 的正确步骤是什么?
![enter image description here](https://istack.dev59.com/2YVDl.webp)
Error running '__rvm_make -j8',
please read /usr/share/rvm/log/1655413907_ruby-2.5.0/make.log
There has been an error while running make. Halting the installation.
如果我尝试安装Ruby 2.7.0、2.7.1、2.7.2及更高版本,就会出现相同的错误。
我在这里找到了建议here,建议使用以下步骤:
rvm pkg install openssl
rvm remove x.x.x
rvm install x.x.x -C --with-openssl-dir=$HOME/.rvm/usr 这样安装成功了,但是一些库(如pg、rails或puma)不能与以这种方式安装的Ruby版本一起使用。例如,在bundle install之后,如果运行“rails db:migrate”命令,它将从pg gem给出另一个错误-Segmentation fault。
/usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/record.rb:113: [BUG] Segmentation fault at 0x00007f03df83e140
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0011 p:0009 s:0055 e:000053 METHOD /usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/record/entry.rb:53
c:0010 p:0014 s:0047 e:000046 METHOD /usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/record/entry.rb:18
c:0009 p:0039 s:0042 e:000041 METHOD /usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/record.rb:100
c:0008 p:0070 s:0034 e:000033 METHOD /usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/record.rb:68
c:0007 p:0009 s:0028 e:000027 BLOCK /usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:76
c:0006 p:0017 s:0025 e:000024 METHOD /usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:103
c:0005 p:0008 s:0018 e:000017 BLOCK /usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:76 [FINISH]
c:0004 p:---- s:0014 e:000013 CFUNC :each
c:0003 p:0011 s:0010 e:000009 BLOCK /usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:75 [FINISH]
c:0002 p:0007 s:0006 e:000005 BLOCK /usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/internals/thread_pool.rb:6 [FINISH]
c:0001 p:---- s:0003 e:000002 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
/usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/internals/thread_pool.rb:6:in `block in add'
/usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:75:in `block in start'
/usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:75:in `each'
/usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:76:in `block (2 levels) in start'
/usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:103:in `_timed'
/usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/adapter/base.rb:76:in `block (3 levels) in start'
/usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/record.rb:67:in `build'
/usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/record.rb:102:in `_fast_build_dir'
/usr/share/rvm/gems/ruby-2.5.0/gems/listen-3.1.5/lib/listen/record/entry.rb:18:in `children'
-- Machine register context ------------------------------------------------
RIP: 0x00007f03df83e140 RBP: 0x000055e2c1faa3e8 RSP: 0x00007ffcb2ab4718
RAX: 0x0000000000000000 RBX: 0x00007f03df8412c0 RCX: 0x0000000000000000
RDX: 0x000055e2bc30f010 RDI: 0x000055e2c1faa6c0 RSI: 0x000055e2c260c540
R8: 0x0000000000000000 R9: 0x0000000000000000 R10: 0x00007f03dff62630
R11: 0x00007f03e0076890 R12: 0x000055e2c1faa3e0 R13: 0x00007f03dfd83b10
R14: 0x0000000000000000 R15: 0x000055e2c2670fd0 EFL: 0x0000000000010202
-- C level backtrace information -------------------------------------------
Unexpected size of .debug_line in /usr/share/rvm/rubies/ruby-2.5.0/bin/ruby
/usr/share/rvm/rubies/ruby-2.5.0/lib/libruby.so.2.5(rb_vm_bugreport+0x4ae) [0x7f03e16b18ce]
/usr/share/rvm/rubies/ruby-2.5.0/lib/libruby.so.2.5(0xaafbd) [0x7f03e152ffbd]
/usr/share/rvm/rubies/ruby-2.5.0/lib/libruby.so.2.5(0x19e2e6) [0x7f03e16232e6]
/lib/x86_64-linux-gnu/libc.so.6(0x7f03e128e520) [0x7f03e128e520]
/lib/x86_64-linux-gnu/libssl.so.3(0x7f03df83e140) [0x7f03df83e140]
根据这篇文章在此输入链接描述, pg gem 的问题也与 OpenSSL 版本有关。因此,这两个问题都与 Ubuntu 22.04 自带的 OpenSSL 版本有关,但我找不到任何指南,逐步说明如何修复它或如何使用旧的 OpenSSL 版本进行 Ruby 安装,以避免所有这些错误。那么,在 Ubuntu 22.04 上安装 Ruby 的正确步骤是什么?