Ubuntu 18.04になって早速、octopress環境をセットアップしようとruby 2.3.1をインストールしようとした。
Octopressをセットアップするのとおり、
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
sudo apt-get install gcc build-essential libssl-dev libreadline-dev zlib1g-dev
rbenv install 2.3.1
rbenv install 2.3.1
したら
BUILD FAILED (Ubuntu 18.04 using ruby-build 20180424)
Inspect or clean up the working tree at /tmp/ruby-build.20180429220407.5386
Results logged to /tmp/ruby-build.20180429220407.5386.log
Last 10 log lines:
installing rdoc: /home/arimasou16/.rbenv/versions/2.3.1/share/ri/2.3.0/system
installing capi-docs: /home/arimasou16/.rbenv/versions/2.3.1/share/doc/ruby
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Try running `apt-get install -y libssl-dev` to fetch missing dependencies.
Configure options used:
--prefix=/home/arimasou16/.rbenv/versions/2.3.1
LDFLAGS=-L/home/arimasou16/.rbenv/versions/2.3.1/lib
CPPFLAGS=-I/home/arimasou16/.rbenv/versions/2.3.1/include
libssl-dev
はインストール済なのに、どうして…
GitHub - rbenv/ruby-build: Compile and install Rubyを見て、
cd "$(rbenv root)"/plugins/ruby-build && git pull
ruby-build
をアップグレードしても最新。
Home · rbenv/ruby-build Wiki · GitHubの Suggested build environmentを見て
sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
しても駄目。
答えはここにあった Can’t build on Ubuntu 18.04 (bionic64) · Issue #1199 · rbenv/ruby-build · GitHub
Ruby < 2.4 is not compatible with openssl 1.1.
You need to install libssl1.0-dev.
arimasou16@Lemur:~$ openssl version
OpenSSL 1.1.0g 2 Nov 2017
ruby2.4未満はopenssl 1.1と互換性がない。
sudo apt install libssl1.0-dev
これで解決。