使用 RVM 安装 ruby​​ 3.2.1 时如何修复“正在运行 '__rvm_make -j4'”错误?

Pra*_*u U 24 ruby linux rvm

我正在尝试使用 RVM 安装 ruby​​ 3.2.1。我收到以下错误。

05:44:55 # rvm install ruby-3.2.1
Warning! PATH is not properly set up, /usr/local/rvm/gems/ruby-2.6.5/bin is not at first place.
         Usually this is caused by shell initialization files. Search for PATH=... entries.
         You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
         To fix it temporarily in this shell session run: rvm use ruby-2.6.5
         To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
Searching for binary rubies, this might take some time.
No binary rubies available for: oracle/6/x86_64/ruby-3.2.1.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for oracle.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-3.2.1, this may take a while depending on your cpu(s)...
ruby-3.2.1 - #downloading ruby-3.2.1, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 19.5M  100 19.5M    0     0  20.6M      0 --:--:-- --:--:-- --:--:-- 29.5M
No checksum for downloaded archive, recording checksum in user configuration.
ruby-3.2.1 - #extracting ruby-3.2.1 to /usr/local/rvm/src/ruby-3.2.1.....
ruby-3.2.1 - #configuring..................................................................
ruby-3.2.1 - #post-configuration..
ruby-3.2.1 - #compiling.......................
Error running '__rvm_make -j4',
please read /usr/local/rvm/log/1677498306_ruby-3.2.1/make.log

There has been an error while running make. Halting the installation.
Run Code Online (Sandbox Code Playgroud)

以下是 make.log 的输出

[2023-02-27 05:45:41] __rvm_make
__rvm_make () 
{ 
    \make "$@" || return $?
}
current path: /usr/local/rvm/src/ruby-3.2.1
GEM_HOME=/usr/local/rvm/gems/ruby-2.6.5
PATH=/usr/lib/oracle/12.1/client64/bin:/root/jdk1.6.0_45/bin/:/root/.nvm/versions/node/v11.13.0/bin:/usr/local/rvm/gems/ruby-2.6.5/bin:/usr/local/rvm/gems/ruby-2.6.5@global/bin:/usr/local/rvm/rubies/ruby-2.6.5/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin:/root/bin
GEM_PATH=/usr/local/rvm/gems/ruby-2.6.5:/usr/local/rvm/gems/ruby-2.6.5@global
command(2): __rvm_make -j4
--bash,383+ make -j4
    BASERUBY = /usr/local/rvm/rubies/ruby-2.6.5/bin/ruby --disable=gems
    CC = gcc -std=gnu99
    LD = ld
    LDSHARED = gcc -std=gnu99 -shared
    CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wno-maybe-uninitialized   -fPIC 
    XCFLAGS = -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/15.0.0 
    CPPFLAGS =   
    DLDFLAGS = -Wl,-soname,libruby.so.3.2  -fstack-protector  
    SOLIBS =  -lz -lrt -lrt -lgmp -ldl -lcrypt -lm -lpthread 
    LANG = en_US.UTF-8
    LC_ALL = 
    LC_CTYPE = UTF-8
    MFLAGS = - --jobserver-fds=3,4 -j
    RUSTC = no
    YJIT_RUSTC_ARGS = --crate-name=yjit --crate-type=staticlib --edition=2021 -g -C opt-level=3 -C overflow-checks=on '--out-dir=/usr/local/rvm/src/ruby-3.2.1/yjit/target/release/' ./yjit/src/lib.rs

compiling ./main.c
compiling dmydln.c
compiling miniinit.c
compiling dmyext.c
making dummy probes.h
compiling ast.c
In file included from ./include/ruby/internal/intern/class.h:24,
                 from ./include/ruby/internal/anyargs.h:76,
                 from ./include/ruby/ruby.h:27,
                 from dmydln.c:1:
./include/ruby/internal/value.h:128: error: expected declaration specifiers or '...' before numeric constantIn file included from ./include/ruby/internal/intern/class.h:24,
                 from ./include/ruby/internal/anyargs.h:76,
                 from ./include/ruby/ruby.h:27,
                 from internal.h:31,
                 from ast.c:2:
Run Code Online (Sandbox Code Playgroud)

我尝试了稳定的RVM并做了rvm install ruby​​ 3.2.1,它也不起作用。该节点位于 OEL 6 和 RVM 1.29.12 有人可以帮忙修复此错误并安装 ruby​​ 3.2.1

Nee*_*mar 58

首先检查你的系统中已经安装了哪些openssl。

which openssl
Run Code Online (Sandbox Code Playgroud)

尝试找出 openssl 目录的路径。就我而言,它是在/usr/local/opt/openssl@3.1

cd /usr/local/opt/openssl@3.1
Run Code Online (Sandbox Code Playgroud)

现在运行命令

rvm install ruby-3.2.1 -C --with-openssl-dir=/usr/local/opt/openssl@3.1
Run Code Online (Sandbox Code Playgroud)

它将解决您的问题。

  • 有人给这家伙喝杯啤酒 (2认同)

Haf*_*man 20

在最新版本的 Ubuntu 22.04 上安装 ruby​​ 时,我在尝试使用 RVM 安装 Ruby 时遇到了一个常见问题。但是,我可以通过执行以下命令解决此问题:

rvm install ruby-3.2.1 -C --with-openssl-dir=/opt/local/libexec/openssl11

如果未安装 OpenSSL,您可以参考此在 Ubuntu 22.04 上安装 Ruby 版本 2.7.6 的综合指南

问题的根本原因源于Ubuntu 22.04仅提供OpenSSL 3.0,而只有一些最新的Ruby版本3.1及以上才支持OpenSSL 3.0。您可以在GitHub 讨论上找到有关此问题的更多详细信息

我在我的 mac 操作系统上也遇到了类似的问题,我通过不使用openssl@3默认安装它来修复它,它oppenssl@2.8.3也可以在 mac 上使用,否则我们也会_rvm_make-j在 mac 上遇到类似的问题。


小智 7

我对 ruby​​-3.1.2 也有同样的问题。我按照以下说明进行操作:

brew uninstall --ignore-dependencies openssl
brew reinstall openssl@3
rvm install ruby-3.1.2 --reconfigure --enable-yjit --with-openssl-dir=$(brew --prefix openssl@3)
Run Code Online (Sandbox Code Playgroud)

此链接提供了更多详细信息(由唯一的 BrianHawley 进行的调查): https://github.com/rvm/rvm/issues/5365