使用 rbenv 安装新 ruby 版本时出现 readline 错误
readline error upon installing a new ruby version using rbenv
正在尝试使用 rbenv install 2.3.1
安装 ruby-2.3.1。
以下是上述失败命令的错误跟踪。
BUILD FAILED (Amazon Linux AMI 2016.09 using ruby-build 20160602)
Inspect or clean up the working tree at /tmp/ruby-build.20161024151611.24040
Results logged to /tmp/ruby-build.20161024151611.24040.log
Last 10 log lines:
# define rl_username_completion_function username_completion_function
^
readline.c:1780:37: note: in expansion of macro 'rl_username_completion_function'
rl_username_completion_function);
^
make[2]: *** [readline.o] Error 1
make[2]: Leaving directory /tmp/ruby-build.20161024151611.24040/ruby-2.3.1/ext/readline'
make[1]: *** [ext/readline/all] Error 2
make[1]: Leaving directory/tmp/ruby-build.20161024151611.24040/ruby-2.3.1'
sudo yum install readline-devel
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest | 2.1 kB 00:00
amzn-updates/latest | 2.3 kB 00:00
Package readline-devel-6.2-9.14.amzn1.x86_64 already installed and latest version
Nothing to do
您可以尝试使用 rvm:https://rvm.io/rvm/install
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable
rvm install ruby-2.3.1
Tested in (Amazon Linux AMI 2016.09 using ruby-build 20160913-13-g8ef0c34)
Run the following commands in terminal
$ sudo yum install -y git gcc openssl-devel readline-devel zlib-devel
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ ~/.rbenv/bin/rbenv init
$ source ~/.bash_profile
$ eval "$(rbenv init -)"
$ type rbenv
$ git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
$ rbenv install 2.3.1
$ rbenv install 2.3.1
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
Installing ruby-2.3.1...
Installed ruby-2.3.1 to /home/ec2-user/.rbenv/versions/2.3.1
正在尝试使用 rbenv install 2.3.1
安装 ruby-2.3.1。
以下是上述失败命令的错误跟踪。
BUILD FAILED (Amazon Linux AMI 2016.09 using ruby-build 20160602)
Inspect or clean up the working tree at /tmp/ruby-build.20161024151611.24040
Results logged to /tmp/ruby-build.20161024151611.24040.log
Last 10 log lines:
# define rl_username_completion_function username_completion_function
^
readline.c:1780:37: note: in expansion of macro 'rl_username_completion_function'
rl_username_completion_function);
^
make[2]: *** [readline.o] Error 1
make[2]: Leaving directory /tmp/ruby-build.20161024151611.24040/ruby-2.3.1/ext/readline'
make[1]: *** [ext/readline/all] Error 2
make[1]: Leaving directory/tmp/ruby-build.20161024151611.24040/ruby-2.3.1'
sudo yum install readline-devel
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest | 2.1 kB 00:00
amzn-updates/latest | 2.3 kB 00:00
Package readline-devel-6.2-9.14.amzn1.x86_64 already installed and latest version
Nothing to do
您可以尝试使用 rvm:https://rvm.io/rvm/install
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable
rvm install ruby-2.3.1
Tested in (Amazon Linux AMI 2016.09 using ruby-build 20160913-13-g8ef0c34)
Run the following commands in terminal
$ sudo yum install -y git gcc openssl-devel readline-devel zlib-devel
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ ~/.rbenv/bin/rbenv init
$ source ~/.bash_profile
$ eval "$(rbenv init -)"
$ type rbenv
$ git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
$ rbenv install 2.3.1
$ rbenv install 2.3.1 perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_CTYPE = "UTF-8", LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). Downloading ruby-2.3.1.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2 Installing ruby-2.3.1... Installed ruby-2.3.1 to /home/ec2-user/.rbenv/versions/2.3.1