LoginSignup
2
0

More than 1 year has passed since last update.

rbenvで3.1.2がインストールできない

Last updated at Posted at 2022-10-04

環境

ubuntu: 20.04.5
rbenv 1.2.0: gitでインストール
ruby-build 20220930: gitでインストール

現象

$ rbenv install 3.1.2
...
current directory: /home/UserName/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rbs-2.1.0/ext/rbs_extension
make DESTDIR\\=
make: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory

make failed, exit code 127
...
        from ./tool/rbinstall.rb:899:in `block in install'
        from ./tool/rbinstall.rb:713:in `no_write'
        from ./tool/rbinstall.rb:899:in `install'
        from ./tool/rbinstall.rb:1068:in `block (2 levels) in <main>'
        from ./tool/rbinstall.rb:1043:in `foreach'
        from ./tool/rbinstall.rb:1043:in `block in <main>'
        from ./tool/rbinstall.rb:1127:in `block in <main>'
        from ./tool/rbinstall.rb:1124:in `each'
        from ./tool/rbinstall.rb:1124:in `<main>'
make: *** [uncommon.mk:383: do-install-all] Error 1

で止まってしまう現象が発生。libcrypt.so.1が見つからないようだ。

対策1

$ whereis libcrypt.so.1 

#見つからない場合
$ sudo dpkg --add-architecture i386
$ sudo apt update
$ sudo apt install libcrypt1:i386

$ whereis libcrypt.so.1                                                               
libcrypt.so.1: /usr/lib/x86_64-linux-gnu/libcrypt.so.1

libcrypt.so.1がインストールできた。

対策2

インストール出来てもこのファイルを使ってくれるかどうかは分からないので環境変数にPATHを通す。

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib/x86_64-linux-gnu
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu 

この辺りは環境にもよるが手元の環境だと、上記の2箇所にlibcrypt.so.1があったので両方追加した。

解決

$ rbenv versions
3.1.2
2
0
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
2
0