8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ubuntu 18.04でrbenvを使ったrubyのインストールに失敗した場合 (openssl 関係)

Posted at

Ubuntu 18.04でrbenvを使ったrubyのインストールに失敗した場合 (openssl 関係)

コマンドとエラー内容

okazaki@MyComputer:~$ rbenv install 2.7.0
Downloading ruby-2.7.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0.tar.bz2
Installing ruby-2.7.0...
~~~~~ 省略 ~~~~~
installing library scripts:         /home/okazaki/.rbenv/versions/2.7.0/lib/ruby/2.7.0
installing common headers:          /home/okazaki/.rbenv/versions/2.7.0/include/ruby-2.7.0
installing manpages:                /home/okazaki/.rbenv/versions/2.7.0/share/man (man1, man5)
installing default gems from lib:   /home/okazaki/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0 (build_i
nfo, cache, doc, extensions, gems, specifications)
                                    benchmark 0.1.0
/tmp/ruby-build.20200501010852.12823.FT2oz0/ruby-2.7.0/lib/rubygems/core_ext/kernel_require.rb:92:in
 `require': cannot load such file -- openssl (LoadError)
        from /tmp/ruby-build.20200501010852.12823.FT2oz0/ruby-2.7.0/lib/rubygems/core_ext/kernel_req
uire.rb:92:in `require'
        from /tmp/ruby-build.20200501010852.12823.FT2oz0/ruby-2.7.0/lib/rubygems/specification.rb:24
26:in `to_ruby'
        from ./tool/rbinstall.rb:841:in `block (2 levels) in install_default_gem'
        from ./tool/rbinstall.rb:278:in `open_for_install'
        from ./tool/rbinstall.rb:840:in `block in install_default_gem'
        from ./tool/rbinstall.rb:830:in `each'
        from ./tool/rbinstall.rb:830:in `install_default_gem'
        from ./tool/rbinstall.rb:794:in `block in <main>'
        from ./tool/rbinstall.rb:945:in `block in <main>'
        from ./tool/rbinstall.rb:942:in `each'
        from ./tool/rbinstall.rb:942:in `<main>'
uncommon.mk:373: recipe for target 'do-install-all' failed
make: *** [do-install-all] Error 1

環境

  • WSL (Windows Subsystem for Linux)
  • Ubuntu 18.04 LTS
  • rbenv 1.1.2-30-gc879cb0

rbenvは下記を見てインストール
★ ubuntu + rbenvでrubyをインストール
https://qiita.com/go_d_eye_0505/items/44d12ef0d52b2dc9d560

確認した項目

このエラー内容を元に解決策を確認。

/tmp/ruby-build.20200501010852.12823.FT2oz0/ruby-2.7.0/lib/rubygems/core_ext/kernel_require.rb:92:in
 `require': cannot load such file -- openssl (LoadError)

1: apt install rubygem install openssl
requireに失敗しているのでgemでインストールする必要があるような気がしたけれど、たぶんいらない。
ログは無いけれど、同じくopensslの関係でエラーが起きてインストールは失敗した。

2: opensslのバージョン

okazaki@MyComputer:~$ openssl version
OpenSSL 1.1.1  11 Sep 2018

試した内容と解決方法

1: opensslの更新
sudo apt update && sudo apt upgrade openssl
2: 開発に必要なパッケージのインストール
sudo apt install libssl-dev zlib1g-dev

2 のインストール作業で解決しました。
根本的な原因は不明ですが、libssl-devをインストールすることで openssl に関係する解決したと思います。

okazaki@MyComputer:~$ rbenv install 2.7.0
Downloading ruby-2.7.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0.tar.bz2
Installing ruby-2.7.0...
Installed ruby-2.7.0 to /home/okazaki/.rbenv/versions/2.7.0
8
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?