Project

General

Profile

Actions

Bug #19048

open

Install of Ruby 3.1.x fails on Ubuntu 20.04 running on WSL

Added by NickGrahamDfE (Nick Graham) 4 months ago. Updated 3 months ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:110255]

Updated by NickGrahamDfE (Nick Graham) 4 months ago

Attempting to install Ruby 3.1.x fails when executed with asdf install ruby 3.1.2 or rbenv install 3.1.2. Attempts to install 3.1.0 and 3.1.1 also fail. 3.0.3 and 3.2.0-preview2 succeed. rbenv and all elements of ruby were uninstalled before attempting to install with asdf. The error messages discussed below are the same for both the asdf and rbenv installs.

The output from the install is BUILD FAILED (Ubuntu 20.04 using ruby-build 20221004) and the logs show this

Building native extensions. This could take a while...
/tmp/ruby-build.20221011135449.3126.agFWSF/ruby-3.1.2/lib/rubygems/ext/builder.rb:95:in `run': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)

    current directory: /home/ubadmin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0/ext/rbs_extension
/home/ubadmin/.asdf/installs/ruby/3.1.2/bin/ruby --disable\\=gems -I/home/ubadmin/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/x86_64-linux -I /tmp/ruby-build.20221011135449.3126.agFWSF/ruby-3.1.2/lib -r ./siteconf20221011-16881-tbjk7q.rb extconf.rb
creating Makefile

current directory: /home/ubadmin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0/ext/rbs_extension
make DESTDIR\\= clean
make[1]: Entering directory '/home/ubadmin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0/ext/rbs_extension'
make[1]: Leaving directory '/home/ubadmin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0/ext/rbs_extension'

current directory: /home/ubadmin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0/ext/rbs_extension
make DESTDIR\\=
make[1]: Entering directory '/home/ubadmin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0/ext/rbs_extension'
compiling constants.c
as: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
make[1]: *** [Makefile:246: constants.o] Error 1
make[1]: Leaving directory '/home/ubadmin/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0/ext/rbs_extension'

make failed, exit code 2

I'm able to install the rbs gem successfully though using gem install rbs -v 2.1.0

Updated by mame (Yusuke Endoh) 4 months ago

as: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory

This seems to be the cause, but I don't know why it's happening.

I write down what I can think of:

  • Can you invoke as command? Does as --version work?
  • Have you installed binutils with asdf or similar?
  • Is there /lib/x86_64-linux-gnu/libcrypt.so.1?
  • What happens if you do apt-get install libcrypt1?

Updated by NickGrahamDfE (Nick Graham) 4 months ago

  • Can you invoke as command? Does as --version work? Yes, it returns:
GNU assembler (GNU Binutils) 2.39
... [removed copyright text]
This assembler was configured for a target of `x86_64-pc-linux-gnu'.
  • Have you installed binutils with asdf or similar? It's installed with brew as well as the automatic apt install
    apt list binutils returns binutils/focal-updates,focal-security,now 2.34-6ubuntu1.3 amd64 [installed,automatic]
    brew list binutils returns /home/linuxbrew/.linuxbrew/Cellar/binutils/2.39_1
    it doesn't look like I can remove the brew installed version as many things are dependent on it

  • Is there /lib/x86_64-linux-gnu/libcrypt.so.1? Yes, it's a symbolic link to libcrypt.so.1.1.0

  • What happens if you do apt-get install libcrypt1?

libcrypt1 is already the newest version (1:4.4.10-10ubuntu4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Updated by masa-iwasaki (Masatoshi Iwasaki) 3 months ago

I faced the same error and succeeded to build 3.1.2 by following steps.

  • Uninstall rbenv & ruby-build if you have already installed them with linuxbrew
  • Disable linuxbrew temporally
  • Install rbenv & ruby-build by git clone
  • Run rbenv install 3.1.2

You can disable linuxbrew by commenting out the configuration like below in your dotfiles.

# eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

It seems that linuxbrew has some problems with libcrypt.so.1. You can find them in GitHub Discussions of homebrew.

https://github.com/orgs/Homebrew/discussions?discussions_q=libcrypt.so.1

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0