can't get “rails console” to work on ubuntu 11.10

天大地大妈咪最大 提交于 2019-12-06 00:11:38

问题


I want to use rails console and I'm using ubuntun 11.10 currently I have found the issue

error is something :

completion.rb:9:in `require': no such file to load -- readline (LoadError)

and I found a way to solve it:

http://blog.jasonmeridth.com/2010/11/25/readline-error-with-rvm-and-rails-3.html

but seems in ubuntu 11.10 the libreadline5-dev is missed and it is replaced with version 6

I installed version 6 and also I get the version 5 from

https://launchpad.net/ubuntu/oneiric/i386/libreadline-gplv2-dev/5.2-9ubuntu1

but yet if I try to run following code :

ruby extconf.rb

I'll get following lines :

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

the "no"s part is my problem , so how can I solve this problem?


回答1:


Ubuntu 11.10 uses newer readline library which not in sync with the readline package offered by rvm

To solve this (assuming you use single-user installation of rvm) do:

1) ensure you have installed ubuntus readline and editline dev packages

sudo apt-get install libreadline6 libreadline6-dev

2) configure ruby's readline extension to use the systems libs, not rvm's packages

rvm pkg uninstall readline
cd ~/.rvm/src/ruby-1.9.2-p290/ext/readline
ruby extconf.rb --with-editline-dir=/usr/ --with-readline-dir=/usr/
make
make install

3) go to your project and start up the rails console



Tip: You can call

rvm requirements

to see what ubuntu packages should be installed to use rvm ruby




回答2:


You have to install the readline development packages before compiling ruby. Just run

sudo apt-get install libreadline6-dev

Alternative (as suggested in the article you linked) you can use RVM to get the appropriate readline sources by running

rvm package install readline

Edit: Once you've installed the readline packages from source, you can install your rubies like this

rvm install 1.9.3 --with-readline-dir="$rvm_path/usr"

If you alredy have installd a specific ruby, just use reinstall instead on install.



来源:https://stackoverflow.com/questions/8583224/cant-get-rails-console-to-work-on-ubuntu-11-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!