使用rvm安装Ruby时出错:“__rvm_make -j8”

prdp8dxp  于 12个月前  发布在  Ruby
关注(0)|答案(1)|浏览(253)

我尝试使用rvm安装最新的稳定Ruby版本(3.1.x3.2.x)。但是,这些版本的rvm install命令在编译Ruby时都会失败。例如,当试图运行

rvm install 3.1.4

我得到以下输出:

Searching for binary rubies, this might take some time.
No binary rubies available for: osx/13.5/arm64/ruby-3.1.4.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Updating certificates bundle '/opt/homebrew/etc/[email protected]/cert.pem'
Requirements installation successful.
Installing Ruby from source to: /Users/davidlj95/.rvm/rubies/ruby-3.1.4, this may take a while depending on your cpu(s)...
ruby-3.1.4 - #downloading ruby-3.1.4, 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.9M  100 19.9M    0     0  12.8M      0  0:00:01  0:00:01 --:--:-- 12.8M
No checksum for downloaded archive, recording checksum in user configuration.
/Users/davidlj95/.rvm/tmp/rvm_src_74481
ruby-3.1.4 - #extracting ruby-3.1.4 to /Users/davidlj95/.rvm/src/ruby-3.1.4 - please wait
ruby-3.1.4 - #configuring - please wait
ruby-3.1.4 - #post-configuration - please wait
ruby-3.1.4 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/davidlj95/.rvm/log/1692282742_ruby-3.1.4/make.log

There has been an error while running make. Halting the installation.

less -p error /Users/davidlj95/.rvm/log/1692282742_ruby-3.1.4/make.log文件中查找错误。
失败之前出现的最后一个错误似乎与OpenSSL有关:

ossl_ts.c:829:5: error: incomplete definition of type 'struct TS_verify_ctx'
    TS_VERIFY_CTX_set_certs(ctx, x509inter);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ...
make[1]: *** [ext/openssl/all] Error 2
make: *** [build-ext] Error 2
+__rvm_make:0> return 2
1 warning and 1 error generated.

我使用的是M1 / ARM芯片组MacBook Pro。macOS Ventura 13.5
我试过:

  • 安装rvm list known中出现的最新版本:3.0.0.它也失败了。
  • 转到提取Ruby源代码的路径并运行make -j8。失败是因为同样的原因。
  • brew install [[email protected]](https://stackoverflow.com/cdn-cgi/l/email-protection)在看到你可能需要一个旧版本的OpenSSL来构建Ruby之后。已经安装好了。也没找到。
  • 确保Makefile中出现的OpenSSL的位置存在
  • 安装最新版本的OpenSSL:brew install openssl@3。也没找到。
qxgroojn

qxgroojn1#

正如Ruby构建指南所建议的那样,为预编译步骤导出配置参数环境变量,指示Homebrew安装的库的安装位置。您可以通过运行以下命令来执行此操作:

export CONFIGURE_ARGS=""
for ext in openssl readline libyaml zlib; do 
  CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-$ext-dir=$(brew --prefix $ext)" 
done

然后运行rvm install命令。编译成功,并安装了该Ruby版本。支持多个Ruby版本。

相关问题