Techioz Blog

RVM を使用した Ruby のインストール中にエラーが発生しました:「__rvm_make -j8」

概要

RVMを使用して最新の安定したRubyバージョン(3.1.x、3.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 ベンチュラ 13.5 を搭載。

私はもう試した:

解決策

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 バージョンで動作しました。