在ubuntu上使用rvm安装ruby 1.9.3

时间:2012-01-19 03:07:53

标签: rvm readline ruby-1.9.3 libreadline

  

可能重复:
  Ruby 1.9.2 and Rails 3 cannot open rails console

我已经安装了rvm和ruby 1.9.2,两者都正常工作。使用rvm版本1.10.2。我之前安装了rvm软件包readline / zlib,但现在我现在遇到了readline的麻烦。我正在尝试在rvm中安装ruby 1.9.3,但我总是找不到readline。

我试图遵循不同的解决方案:

 rvm remove 1.9.3
 rvm pkg install readline
 rvm install 1.9.3 --with-readline-dir=$rvm_path/usr/ \
     --with-zlib-dir=$rvm_path/usr/

 rvm use 1.9.3
 rvmsudo gem install bundler
 bundle install (all gems installed fine)
 rails c / rails s 
 .rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/completion.rb:9:in `require': \
     cannot load such file -- readline (LoadError)

我安装了libreadline-dev(版本6,当前版本)(这些软件包所需的一切)

我也尝试了以下内容:

.rvm/src/ruby-1.9.3-p0/ext/readline]$ 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

.rvm/src/ruby-1.9.3-p0/ext/readline]$ ruby extconf.rb \
    --with-readline-dir=/home/claudiocontin/.rvm/usr/
 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

 .rvm/src/ruby-1.9.3-p0/ext/readline]$ ruby extconf.rb \
    --with-readline-lib=/home/claudiocontin/.rvm/usr/
 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

当然没有生成Makefile ......

 apt-get install libreadline-dev
 Reading package lists... Done
 Building dependency tree       
 Reading state information... Done
 libreadline-dev is already the newest version.

想法?

3 个答案:

答案 0 :(得分:45)

我尝试做rvm pkg readline,安装ubuntu pkgs等没有任何成功。什么对我有用:

gem install rb-readline

并将以下行添加到您的Gemfile中:

gem 'rb-readline'

答案 1 :(得分:12)

我最终做的是从rvm usr / lib / path中删除所有libreadline。

手动下载安装的libreadline5-dev软件包(本例中为.deb),因为新的ubuntu发行版只有libreadline6-dev作为候选者。

转到rvm ruby​​ 1.9.3 src和:

ruby extconf.rb --with-editline-dir=/usr/ --with-readline-dir=/usr/
make
sudo make install

现在就像一个魅力。

非常痛苦的事情:)

编辑:

还要记住,readline现在也使用了libeditline-dev,你可以在配置ruby readline时手动禁用,传递: - disable-libedit

 ruby extconf --disable-libedit

答案 2 :(得分:5)

我总是发现让RVM能够很好地使用包来做一些伏都教。很多时候,它是关于捕捉一个依赖 - 我把一个我以前运气好的脚本放在一起,试试这个:

sudo apt-get install zlib1g-dev libssl-dev libsqlite3-dev libmysqlclient-dev imagemagick librmagick-ruby libxml2-dev libxslt1-dev build-essential openssl libreadline6 libreadline6-dev zlib1g libyaml-dev libsqlite3-0 sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison libpq-dev libpq5 libmysql-ruby libmysqlclient-dev

rvm pkg install autoconf
rvm pkg install zlib
rvm pkg install readline
rvm pkg install openssl
rvm pkg install iconv
rvm install 1.9.3
rvm use 1.9.3 --default