Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Readline not working in rvm - Ubuntu 11.10

Tags:

ruby

rvm

readline

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?

like image 381
Sayuj Avatar asked Dec 29 '11 09:12

Sayuj


3 Answers

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.

like image 181
zzeroo Avatar answered Nov 13 '22 07:11

zzeroo


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!

like image 22
Sayuj Avatar answered Nov 13 '22 06:11

Sayuj


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.

like image 38
apb Avatar answered Nov 13 '22 05:11

apb