@ledsun blog

Hのキーがhellで、Sのキーがslaveだ、と彼は思った。そしてYのキーがyouだ。

Ruby 3.2.0-preview2

rbevnとruby-buildを使ってRuby 3.2.0-preview2をインストールします。

ledsun@MSI:~►rbenv install 3.2.0-preview2
To follow progress, use 'tail -f /tmp/ruby-build.20220909111902.4631.log' or pass --verbose
Downloading ruby-3.2.0-preview2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0-preview2.tar.gz
Installing ruby-3.2.0-preview2...

BUILD FAILED (Ubuntu 20.04 using ruby-build 20220909)

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

Last 10 log lines:
*** Fix the problems, then remove these directories and try again if you want.
make[1]: Leaving directory '/tmp/ruby-build.20220909111902.4631.NjJV3L/ruby-3.2.0-preview2'
Generating RDoc documentation
/tmp/ruby-build.20220909111902.4631.NjJV3L/ruby-3.2.0-preview2/lib/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
uh-oh! RDoc had a problem:
cannot load such file -- psych

run with --debug for full backtrace
make: *** [uncommon.mk:590: rdoc] Error 1

失敗しました。

please install libyaml

とあるのでlibyamlをインストールします。

ledsun@MSI:~►sudo apt install libyaml-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  libyaml-doc
The following NEW packages will be installed:
  libyaml-dev
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 58.2 kB of archives.
After this operation, 257 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libyaml-dev amd64 0.2.2-1 [58.2 kB]
Fetched 58.2 kB in 2s (32.3 kB/s)
Selecting previously unselected package libyaml-dev:amd64.
(Reading database ... 81490 files and directories currently installed.)
Preparing to unpack .../libyaml-dev_0.2.2-1_amd64.deb ...
Unpacking libyaml-dev:amd64 (0.2.2-1) ...
Setting up libyaml-dev:amd64 (0.2.2-1) ...

libyamlのインストールに成功しました。 再度Ruby 3.2.0-preview2をインストールしてみます。

ledsun@MSI:~►rbenv install 3.2.0-preview2
To follow progress, use 'tail -f /tmp/ruby-build.20220909112614.18591.log' or pass --verbose
Downloading ruby-3.2.0-preview2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0-preview2.tar.gz
Installing ruby-3.2.0-preview2...
Installed ruby-3.2.0-preview2 to /home/ledsun/.rbenv/versions/3.2.0-preview2

成功しました。 バージョンをみてみましょう。

ledsun@MSI:~[1]►rbenv local 3.2.0-preview2
ledsun@MSI:~►ruby -v
ruby 3.2.0preview2 (2022-09-09 master 35cfc9a3bb) [x86_64-linux]

うまくいきました。