在Ubuntu 14.04上rbenv构建失败

时间:2014-04-18 13:34:59

标签: ruby ubuntu rbenv

我已经在我的Ubuntu 14.04桌面上成功安装了rbenv(以及构建工具),这似乎工作正常,但是一旦我尝试安装ruby 2.1.1,构建就失败了:

daniel@grape:~$ rbenv install 2.1.1
Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5fe00cda18ca5daeb43762b80c38e06e
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /home/daniel/.rbenv/versions/2.1.1

Downloading ruby-2.1.1.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/e57fdbb8ed56e70c43f39c79da1654b2
Installing ruby-2.1.1...

BUILD FAILED

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

Last 10 log lines:
installing default ripper libraries
compiling ossl_pkcs7.c
compiling ossl_ssl.c
installing default openssl libraries
linking shared-object openssl.so
make[2]: Leaving directory `/tmp/ruby-build.20140418142258.3543/ruby-2.1.1/ext/openssl'
linking shared-object ripper.so
make[2]: Leaving directory `/tmp/ruby-build.20140418142258.3543/ruby-2.1.1/ext/ripper'
make[1]: Leaving directory `/tmp/ruby-build.20140418142258.3543/ruby-2.1.1'
make: *** [build-ext] Error 2

可以在此处找到日志文件的内容:http://pastebin.com/SXxTeCJY

我已经做了一些寻求这个问题的帮助,包括按照这里所说的内容:https://github.com/sstephenson/ruby-build/wiki - 但我没有任何快乐。

2 个答案:

答案 0 :(得分:39)

UPDATE :使用Ruby 2.1.2,它解决了这个问题。


14.04可能带有readline 6.3,使用rl_hook_func_t代替Function

此错误已在Ruby(https://bugs.ruby-lang.org/issues/9578)中报告并修复,但尚未发布。

在Ruby 2.1.2发布之前(我假设它将包含此修复),您可以使用patch来正确支持新的rl_hook_func_t方法。使用它来安装Ruby 2.1.1:

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

(资料来源:http://gorails.com/setup/ubuntu/14.04

答案 1 :(得分:4)

更新:Ruby 2.1.2修复了这个问题。如果您需要使用Chef修补ruby,请使用此处的示例。


使用LWRP

将Ruby 2.1.1的Chef安装到Ubuntu 14.04上

使用Riotgames rbenv cookbook在Trusty Ubuntu(14.04)上修补Ruby 2.1.1的代码 - 剪切和粘贴 - 无保修:-) I have a wrapper cookbook which is tested on Ubuntu 14.04 (release 1.0.4)。最简单的方法就是克隆存储库并将其集中在测试厨房。主要问题是这本食谱使用的是Berkshelf 3.1.1,而大多数人可能仍然使用2。粘贴的代码应该适用于Berkshelf 2.x和3.1.1。

Berksfile

cookbook 'rbenv', github: "RiotGames/rbenv-cookbook"

元数据

depends 'rbenv'

属性(attributes / default.rb)

default['ruby']['version'] = '2.1.1'

食谱(食谱/ default.rb)

# patchutils is required to patch Ruby version
package 'patchutils'

include_recipe "rbenv::default"
include_recipe "rbenv::ruby_build"

# Installs a patched, global, ruby 
rbenv_ruby node['ruby']['version'] do
  global true
  patch "https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/45225/diff?format=diff"
end

Discussion for patch