2

I updated this Lenovo laptop to Ubuntu 22.04 LTS, installed Ruby (3.1.2), rbenv (1.1.2), then Rails (7.0.3) without issue. However, rbenv consistently crashes when I try to install new ruby executables. Thus far I've tried 2.7.2 (compatible with an old Jekyll blog) and 3.0.2. GCC 11.2.0 is being used for compilation. I've reviewed the ruby-build log but don't yet understand how to proceed.

2.7.2 compilation output shown below. Ideas?


BUILD FAILED (Ubuntu 22.04 using ruby-build 20220426-3-g1038c07)

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

Last 10 log lines:
ripper.y: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
linking shared-object ripper.so
make[2]: Leaving directory '/tmp/ruby-build.20220526150603.174696.lPGT5x/ruby-2.7.2/ext/ripper'
linking shared-object date_core.so
make[2]: Leaving directory '/tmp/ruby-build.20220526150603.174696.lPGT5x/ruby-2.7.2/ext/date'
make[1]: Leaving directory '/tmp/ruby-build.20220526150603.174696.lPGT5x/ruby-2.7.2'
make: *** [uncommon.mk:295: build-ext] Error 2```
6
  • I'm expecting /tmp/ruby-build.20220526150603.174696.log to show that we're missing some core dependency. Any useful messages in that file?
    – Richard
    Commented May 26, 2022 at 19:26
  • I noticed this near the end of the log file: make[2]: *** [Makefile:313: ossl_pkey_rsa.o] Error 1 Commented May 26, 2022 at 19:57
  • Can you pastebin.com that file and share the link?
    – Richard
    Commented May 26, 2022 at 20:08
  • pastebin.com/MLR8xgyN Commented May 26, 2022 at 20:11
  • 1
    Older Ruby versions are not compatible with Ubuntu 22.04 unless you build with another version of OpenSSL. See here: stackoverflow.com/questions/72046299/…
    – Casper
    Commented May 27, 2022 at 0:44

1 Answer 1

1

Install the following dependencies (rbenv/ruby-build wiki), then try building/installing ruby.

$ apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev
3
  • 1
    You may need to build an earlier version of OpenSSL for that particular release of ruby. See: github.com/rbenv/ruby-build/discussions/…
    – Richard
    Commented May 26, 2022 at 20:26
  • This just gets weirder. - uninstalled ruby, rbenv & ruby-build. - installed the dependencies mentioned by @richard, above - reinstalled ruby via apt (3.0.2). Confirmed irb works. - reinstalled rbenv. - $rbenv install 3.1.2 (valid, according to $ruby-build -l) - successful. - $rbenv install 2.7.6 (also valid per ruby-build) - failed. - moved to a new empty directory; $rbenv local 3.1.2 --> permission denied. - $sudo rbenv local 3.1.2 --> not installed. That's it for now. I need a tall cool drink. Commented May 26, 2022 at 22:44
  • 1
    @BrianPiercy Careful with using sudo with rbenv. Even a single run with sudo may break your setup, because it's possible rbenv creates files owned by root and now your non-sudo user will not have proper access any more.
    – Casper
    Commented May 27, 2022 at 0:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.