rbenv ruby 安装失败 ubuntu

rbenv ruby install fail ubuntu

这是错误日志

Downloading ruby-2.2.0.tar.gz... -> http://dqw8nmjcqpjn7.cloudfront.net/7671e394abfb5d262fbcd3b27a71bf78737c7e9347fa21c39e58b0bb9c4840fc
Installing ruby-2.2.0...

BUILD FAILED (Ubuntu 14.04 using ruby-build 20141225-7-g4aeeac2)

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

Last 10 log lines:

compiling ossl_x509store.c
compiling ossl_engine.c
compiling ossl_ocsp.c
compiling ossl_config.c
compiling ossl_digest.c
installing default openssl libraries
linking shared-object openssl.so
make[2]: Leaving directory /tmp/ruby-build.20150106233051.25615/ruby-2.2.0/ext/openssl'
make[1]: Leaving directory/tmp/ruby-build.20150106233051.25615/ruby-2.2.0'
make: *** [build-ext] Error 2

我不知道该做什么。我试过了,但是当我输入 ruby -v 时,它仍然告诉我我有旧版本。

sudo apt-get install autoconf bison libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev 

感谢您提出的任何意见,非常感谢。

如果您使用的是 Ubuntu 和/或 Debian,您可以尝试通过 apt-get 安装 libffi-dev。

$ apt-get install libffi-dev

我在论坛上做了一些调查,我在官方的 rbenv 问答部分找到了这个。

https://github.com/sstephenson/ruby-build/wiki#build-failure-of-fiddle-with-ruby-220

先安装这些依赖项,然后在 14.04 上重试 ruby 2.2.0 和 rbenv

sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev

所有其他答案对我来说都失败了...

在多次失败的尝试和研究之后,我发现了适用于许多版本的解决方法:

2.1.1

curl -fsSL https://gist.github.com/mislav/a18b9d7f0dc5b9efc162.txt | rbenv install --patch 2.1.1

2.0.0-p451

curl -fsSL https://gist.github.com/LeonB/10503374/raw | rbenv install --patch 2.0.0-p451

2.0.0-p247

cat <(curl -fsSL https://raw.githubusercontent.com/wayneeseguin/rvm/master/patches/ruby/changeset_r45225.diff) <(curl -fsSL https://raw.githubusercontent.com/wayneeseguin/rvm/master/patches/ruby/changeset_r45240.diff) | sed -E 's/^((---|\+\+\+) )(a|b)\/([^ ]+\s+\(revision [0-9]+\))$//' | sed '/rl_delete_text/d' | rbenv install -p 2.0.0-p247

来源:https://github.com/sstephenson/ruby-build/issues/526

希望我能帮助到任何人。