12

I am using rvm on my ubyntu 11.10. My readline is not working, I tried ruby extconf.rb but it is not passed. Output is bellow:

$ 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

I tried installing 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

What is the problem here? Can anyone help?

Sayuj
  • 6,836
  • 11
  • 54
  • 73

6 Answers6

21

Same issue as here Readline errors prevent me running rails console

Under ubuntu you can use the system readline installation.

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

Substitute ${YOURUBYVERSION} with your desired ruby version.

Community
  • 1
  • 1
zzeroo
  • 4,982
  • 3
  • 30
  • 43
7

I got the solution:

Run the command

rvm requirements

It shows the requirements and dependencies. Install those and reinstall the ruby on rvm

rvm remove 1.9.2
rvm install 1.9.2

It works!

Sayuj
  • 6,836
  • 11
  • 54
  • 73
  • This worked for me, but only after completely removing /usr/local/rvm and re-installing rvm from scratch. It seems the `rvm remove 1.9.2` was not enough to clear out whatever was being cached. – Gabe Martin-Dempesy Mar 03 '12 at 07:52
5

For some reason I can't comment on @zzeroo's answer, but I want to draw attention to the fact that he's using

 --with-readline-dir=/usr/include/readline

instead of

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

I was banging my head against the wall for a long time and changing this fixed it for me.

apb
  • 3,054
  • 3
  • 27
  • 23
2

Have you tried:

rvm pkg install readline

Then install ruby through RVM --with-readline-dir=$rvm_path/usr?

http://beginrescueend.com/packages/readline/

FWIW, I'd suggest giving rbenv + ruby-build a go, if you've never considered it. A lot less headaches than with RVM.

d11wtq
  • 33,252
  • 14
  • 115
  • 186
  • When you say "doesn't work", do you mean you get errors, or something else? What errors do you get (if you get them)? – d11wtq Dec 29 '11 at 10:06
  • I did `rvm remove 1.9.2`, `rvm pkg install readline` and `rvm install 1.9.2 --with-readline-dir=$rvm_path/usr`. No errors. But when I try `irb` it shows, `Readline was unable to be required, if you need completion or history install readline then reinstall the ruby. You may follow 'rvm notes' for dependencies and/or read the docs page https://rvm.beginrescueend.com/packages/readline/ . Be sure you 'rvm remove X ; rvm install X' to re-compile your ruby with readline support after obtaining the readline libraries. ruby-1.9.2-p290 :001 >` – Sayuj Dec 29 '11 at 10:22
  • 1
    What do you get when you do `echo $rvm_path`? If it's empty, you'll have to specify the path manually. – d11wtq Dec 29 '11 at 13:27
  • `/home/sayuj/.rvm` is my rvm path – Sayuj Dec 30 '11 at 05:45
  • Are you willing to ditch rvm and give rbenv a go? It's basically the same thing, but simpler and better. I haven't heard of anybody who changed and decided to go back to RVM. Follow the README and install the counterpart ruby-build to actually compile ruby with `rbenv install 1.9.2-p290`. Just my $0.02. I'm out of ideas with RVM and/or the desire to think about it too much :P – d11wtq Dec 30 '11 at 10:16
  • ruby-build is working fine with the system readline under ubuntu for me. I'm just suggesting the OP tries it. RVM and ruby-build compile ruby differently. RVM attempted to do more 'magic', while ruby-build does a simple out-of-the-box build. – d11wtq Jan 01 '12 at 23:04
2

I've googled for a couple days, but no answers helps me, so my solution was:

Fully remove rvm How to remove rvm

Remove all ruby packages. First, find out which packages do you have:

dpkg -l | grep ruby

then make

sudo apt-get purge {PACKAGE}

where {PACKAGE} is package you want to remove ( for me there were ruby ruby1.8 ruby1.9.1 )

Then I made fresh installation of RVM Install RVM and installed ruby 1.9.2 with

rvm install 1.9.2

Now it should work!

Community
  • 1
  • 1
Ivan
  • 56
  • 4
1

I tried everything, but it didn't work. I had to do rvm implode (after having all the requirements installed) and then rvm install 1.8.7; rvm install 1.9.3 and it wor

Rafael
  • 604
  • 2
  • 6
  • 13