Techioz Blog

依存関係がすでにインストールされている Ruby 3.2.1 ビルドのインストール中にエラーが発生しました (ruby-build を使用した Ubuntu 22.04) が失敗しました

概要

wsl に Ruby 3.2.1 をインストールしようとしています。homebrew を通じてインストールされた rbenv を使用しています。rbenv install 3.2.1 を試してみると、次の結果が得られました。

Installing ruby-3.2.1...
ruby-build: using readline from homebrew
ruby-build: using libyaml from homebrew
ruby-build: using gmp from homebrew

BUILD FAILED (Ubuntu 22.04 using ruby-build 20230615)

Inspect or clean up the working tree at /tmp/ruby-build.20230628033452.57435.3mGe1n
Results logged to /tmp/ruby-build.20230628033452.57435.log

Last 10 log lines:
Try running `apt-get install -y libssl-dev` to fetch missing dependencies.

Configure options used:
  --prefix=/home/cristian/.rbenv/versions/3.2.1
  --enable-shared
  --with-readline-dir=/home/linuxbrew/.linuxbrew/opt/readline
  --with-libyaml-dir=/home/linuxbrew/.linuxbrew/opt/libyaml
  --with-gmp-dir=/home/linuxbrew/.linuxbrew/opt/gmp
  LDFLAGS=-L/home/cristian/.rbenv/versions/3.2.1/lib
  CPPFLAGS=-I/home/cristian/.rbenv/versions/3.2.1/include

すでに apt-get install -y libssl-dev を実行していますが、解決しません。何が足りないのでしょうか?

特に関連するログ部分は次のとおりです。

installing bundled gem cache:       /home/cristian/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/cache
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Try running `apt-get install -y libssl-dev` to fetch missing dependencies.

Configure options used:
  --prefix=/home/cristian/.rbenv/versions/3.2.1
  --enable-shared
  --with-readline-dir=/home/linuxbrew/.linuxbrew/opt/readline
  --with-libyaml-dir=/home/linuxbrew/.linuxbrew/opt/libyaml
  --with-gmp-dir=/home/linuxbrew/.linuxbrew/opt/gmp
  LDFLAGS=-L/home/cristian/.rbenv/versions/3.2.1/lib 
  CPPFLAGS=-I/home/cristian/.rbenv/versions/3.2.1/include 

apt-get install -y libssl-dev と sudo apt install build-essential libssl-dev libreadline-dev zlib1g-dev を試してみました

解決策

homebrewを使用してRuby 3.2.2をインストールすると成功します 手順: