I am getting an error 'block in install_default_gem' when install ruby using rbenv on WSL

Viewed 874

icarus@DESKTOP-1HC4USL:/mnt/c/Users/K$ rbenv install 2.7.1 Downloading ruby-2.7.1.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.1.tar.bz2 Installing ruby-2.7.1...

BUILD FAILED (Ubuntu 20.04 using ruby-build 20200520-12-g69ccbf4)

Inspect or clean up the working tree at /tmp/ruby-build.20200704033744.16541.pfVhNf Results logged to /tmp/ruby-build.20200704033744.16541.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 ' from ./tool/rbinstall.rb:950:in block in <main>' from ./tool/rbinstall.rb:947:in each' from ./tool/rbinstall.rb:947:in `' make: *** [uncommon.mk:373: do-install-all] Error 1

1 Answers

Please make sure that you have installed the dependencies for ruby.

https://github.com/rbenv/ruby-build/wiki#suggested-build-environment

sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev

Some libraries might be missing in different Ubuntu versions. In my case, libgdbm6 was not found on Ubuntu 18.04

Related