在rvm中Readline无法工作 - Ubuntu 11.10

12

我在使用 rvm 在我的 ubuntu 11.10 上。然而我的 readline 不起作用,我尝试了 ruby extconf.rb 但没有通过。输出如下:

$ ruby extconf.rb 
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no

我尝试安装了libncurses5-dev和libreadline5-dev。

$ sudo apt-get install libncurses5-dev libreadline5-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libreadline5-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  libreadline-gplv2-dev:i386 lib64readline-gplv2-dev:i386 libreadline-gplv2-dev

E: Package 'libreadline5-dev' has no installation candidate

这里的问题是什么?有人可以帮忙吗?

6个回答

21

和这里类似的问题

在Ubuntu下,您可以使用系统自带的 readline 工具。

rvm uninstall ${YOURUBYVERSION}
sudo apt-get install libreadline-dev
rvm install ${YOURUBYVERSION} --with-readline-dir=/usr/include/readline

用你希望使用的 Ruby 版本替换 ${YOURUBYVERSION}。


1
嗨,跳转点是 --with-readline-dir=/usr/include/readline - zzeroo

7
我得到了解决方案:
运行命令
rvm requirements

它显示了要求和依赖关系。安装这些并重新在rvm上安装ruby。
rvm remove 1.9.2
rvm install 1.9.2

它有效!


这对我很有效,但仅在彻底删除/ usr / local / rvm并从头重新安装rvm之后才有效。似乎“rvm remove 1.9.2”无法清除缓存的任何内容。 - Gabe Martin-Dempesy

5
由于某些原因,我不能评论@zzeroo的答案,但是我想引起注意的是他使用了HTML标签。
 --with-readline-dir=/usr/include/readline

代替
--with-readline-dir=$rvm_path/usr

我曾经长时间地苦思冥想,最终发现改变以下内容可以解决问题。


2

当你说“不起作用”时,是指你遇到了错误,还是其他问题?如果你遇到了错误,那么你得到了什么样的错误信息? - d11wtq
我使用了以下命令:rvm remove 1.9.2rvm pkg install readlinervm install 1.9.2 --with-readline-dir=$rvm_path/usr。没有错误提示。但是当我尝试运行 irb 的时候出现了以下提示:Readline was unable to be required, if you need completion or history install readline then reinstall the ruby.。你可以通过查看 rvm notes 来获取依赖信息或者访问文档页面 https://rvm.beginrescueend.com/packages/readline/。在获得 readline 库后,请确保您运行 rvm remove X; rvm install X 命令来重新编译带有 readline 支持的 Ruby 版本。ruby-1.9.2-p290 :001 > - Sayuj
1
当你执行 echo $rvm_path 时,会得到什么?如果为空,你就必须手动指定路径。 - d11wtq
/home/sayuj/.rvm 是我的 rvm 路径。 - Sayuj
你愿意放弃RVM,试试rbenv吗?它基本上是相同的东西,但更简单、更好。我没有听说过有人改变主意回到RVM。按照README的说明安装对应的ruby-build,使用rbenv install 1.9.2-p290来编译Ruby。这只是我的个人看法。我已经对RVM或者过多思考它感到无力了 :P - d11wtq
ruby-build在我这里和Ubuntu下的系统readline很好地工作。我只是建议OP尝试一下。RVM和ruby-build以不同的方式编译Ruby。 RVM试图做更多的“魔法”,而ruby-build则进行简单的开箱即用构建。 - d11wtq

2
我已经搜索了几天,但是没有找到有用的答案,所以我的解决方案是:
完全删除rvm 如何删除rvm 删除所有的ruby包。首先,找出你安装了哪些包:
dpkg -l | grep ruby

然后执行

sudo apt-get purge {PACKAGE}

其中{PACKAGE}是您要删除的包(对我来说是ruby ruby1.8 ruby1.9.1

然后我进行了RVM的全新安装安装RVM并安装了ruby 1.9.2。

rvm install 1.9.2

现在应该可以工作了!

1

我尝试了所有的方法,但都没有成功。最后我不得不运行 rvm implode 命令(在安装好所有必要的依赖之后),然后再运行 rvm install 1.8.7 和 rvm install 1.9.3,这样才能正常工作。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接