Resolve `require': no such file to load -- readline (LoadError) exception (especially ruby build from source code)

It gives the exception when I run "rails console". This is how I resolve the problem.
My environment: Ubuntu 12.04, Ruby 1.9.2p290 build from source, Rails 3.0.10

For ruby builded frome source code:
1. Make sure you have libreadline-dev and libncurses5-dev
2. Go to the ruby source code directory
3. Build readline up

Install libreadline-dev
sudo apt-get install libreadline-dev libncurses5-dev
or Some older ubuntu didn't have libreadline-dev try:
sudo apt-get install libreadline5-dev libncurses5-dev

cd (ruby_sourcecode_dir)/ext/readline
ruby extconf.rb
make
sudo make install

For RVM:
Basically same to above. But the path to ext/readline is under .rvm directory.
eg. /home/your_name/.rvm/src/ruby-1.9.2-p290/ext/readline

留言

這個網誌中的熱門文章

神之雫 的 雫 (雨下) 怎麼唸、意思是什麼

[已解決] 入肉 (肏) 的注音/怎麼唸?意思是什麼?(兒童不宜)

哆啦A夢放上任何東西都無違和感、彷彿有音效的滑鼠墊 這裡買得到