8

I am getting this strange error while trying to install ruby 2.7.2 using rbenv.

Does anybody know what the issue is?

$ rbenv install 2.7.2
Installing ruby-2.7.2...

BUILD FAILED (Ubuntu 20.04 using ruby-build 20201005-4-g4761049)

Inspect or clean up the working tree at /tmp/ruby-build.20201106211003.49727.I05SRV
Results logged to /tmp/ruby-build.20201106211003.49727.log

Last 10 log lines:
    from ./tool/rbinstall.rb:846:in `block (2 levels) in install_default_gem'
    from ./tool/rbinstall.rb:279:in `open_for_install'
    from ./tool/rbinstall.rb:845:in `block in install_default_gem'
    from ./tool/rbinstall.rb:835:in `each'
    from ./tool/rbinstall.rb:835:in `install_default_gem'
    from ./tool/rbinstall.rb:799:in `block in <main>'
    from ./tool/rbinstall.rb:950:in `block in <main>'
    from ./tool/rbinstall.rb:947:in `each'
    from ./tool/rbinstall.rb:947:in `<main>'
make: *** [uncommon.mk:373: do-install-all] Error 1

EDIT: Below is the content of the .log file (the full version is 197'000 lines long, so I can only post the last part).

And at the end, it says:

ruby-2.7.2/lib/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- openssl (LoadError)

However, I DO have openssl installed (I use it). What am I missing?

generating x86_64-linux-fake.rb
x86_64-linux-fake.rb updated
./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems -r./x86_64-linux-fake ./tool/rbinstall.rb --make="make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc" --rdoc-output=".ext/rdoc" --html-output=".ext/html"
installing binary commands:         /home/tom/.rbenv/versions/2.7.2/bin
installing base libraries:          /home/tom/.rbenv/versions/2.7.2/lib
installing arch files:              /home/tom/.rbenv/versions/2.7.2/lib/ruby/2.7.0/x86_64-linux
installing pkgconfig data:          /home/tom/.rbenv/versions/2.7.2/lib/pkgconfig
installing extension objects:       /home/tom/.rbenv/versions/2.7.2/lib/ruby/2.7.0/x86_64-linux
installing extension objects:       /home/tom/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/x86_64-linux
installing extension objects:       /home/tom/.rbenv/versions/2.7.2/lib/ruby/vendor_ruby/2.7.0/x86_64-linux
installing extension headers:       /home/tom/.rbenv/versions/2.7.2/include/ruby-2.7.0/x86_64-linux
installing extension scripts:       /home/tom/.rbenv/versions/2.7.2/lib/ruby/2.7.0
installing extension scripts:       /home/tom/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0
installing extension scripts:       /home/tom/.rbenv/versions/2.7.2/lib/ruby/vendor_ruby/2.7.0
installing extension headers:       /home/tom/.rbenv/versions/2.7.2/include/ruby-2.7.0/ruby
installing rdoc:                    /home/tom/.rbenv/versions/2.7.2/share/ri/2.7.0/system
installing html-docs:               /home/tom/.rbenv/versions/2.7.2/share/doc/ruby
installing capi-docs:               /home/tom/.rbenv/versions/2.7.2/share/doc/ruby
installing command scripts:         /home/tom/.rbenv/versions/2.7.2/bin
installing library scripts:         /home/tom/.rbenv/versions/2.7.2/lib/ruby/2.7.0
installing common headers:          /home/tom/.rbenv/versions/2.7.2/include/ruby-2.7.0
installing manpages:                /home/tom/.rbenv/versions/2.7.2/share/man (man1, man5)
installing default gems from lib:   /home/tom/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0 (build_info, cache, doc, extensions, gems, specifications)
                                    benchmark 0.1.0
/tmp/ruby-build.20201107153545.4938.VEdjtZ/ruby-2.7.2/lib/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- openssl (LoadError)
    from /tmp/ruby-build.20201107153545.4938.VEdjtZ/ruby-2.7.2/lib/rubygems/core_ext/kernel_require.rb:92:in `require'
    from /tmp/ruby-build.20201107153545.4938.VEdjtZ/ruby-2.7.2/lib/rubygems/specification.rb:2430:in `to_ruby'
    from ./tool/rbinstall.rb:846:in `block (2 levels) in install_default_gem'
    from ./tool/rbinstall.rb:279:in `open_for_install'
    from ./tool/rbinstall.rb:845:in `block in install_default_gem'
    from ./tool/rbinstall.rb:835:in `each'
    from ./tool/rbinstall.rb:835:in `install_default_gem'
    from ./tool/rbinstall.rb:799:in `block in <main>'
    from ./tool/rbinstall.rb:950:in `block in <main>'
    from ./tool/rbinstall.rb:947:in `each'
    from ./tool/rbinstall.rb:947:in `<main>'
make: *** [uncommon.mk:373: do-install-all] Error 1
TomDogg
  • 3,803
  • 5
  • 33
  • 60
  • You're going to have to dig into that file that's highlighted there. The important details are missing. – tadman Nov 07 '20 at 04:29
  • can you post contents of `/tmp/ruby-build.20201106211003.49727.log`? – zhisme Nov 07 '20 at 09:05
  • @zhisme - I have added the relevant part of the log file. – TomDogg Nov 07 '20 at 15:06
  • Does this answer your question? [Installing Ruby 2.3.x on Ubuntu 18.04 is causing an error by the end of the installation process](https://stackoverflow.com/questions/50085258/installing-ruby-2-3-x-on-ubuntu-18-04-is-causing-an-error-by-the-end-of-the-inst) – hat Nov 13 '20 at 09:35

2 Answers2

14

Long story short, I found out that libssl-dev and libreadline-dev were required, so this solved the problem:

sudo apt-get install libssl-dev libreadline-dev
TomDogg
  • 3,803
  • 5
  • 33
  • 60
0

In RHEL8/CENTOS8:

sudo yum install readline-devel openssl-devel

assuming you already ran:

sudo yum groupinstall "Development Tools"
Daniel Viglione
  • 8,014
  • 9
  • 67
  • 101