Problems with Rails3 and readline

I have been using rails3 for the first time (I have been using rails2 for many years) inside rvm. Trying to start the console, I get this error:

require': no such file to load -- readline

I googled around and this seems to be a common problem. Most of the solutions seem to be related to 1) installing the following: sudo apt-get install libncurses5-dev libreadline5-dev 2) go to the gem folder for readline, run ruby extconf.rb , which generates the make file 3) do make and make install

Now I did not have readline installed in my rvm, so I tried to install it. But it was not possible to determine what a gem is: gem install readline does not give any results. The only thing I found was gem install rdp-rb-readline . I installed two developer libraries, installed gdp-rb-readline gem, went to the next gem folder and ran ruby extconf.rb . It really created a makefile. But I can’t make it or make install : I get these errors:

max-laptop:readline$ make cc -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I. -DHAVE_READLINE_READLINE_H -DHAVE_READLINE_HISTORY_H -DHAVE_RL_FILENAME_COMPLETION_FUNCTION -DHAVE_RL_USERNAME_COMPLETION_FUNCTION -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_DEPREP_TERM_FUNCTION -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_BASIC_WORD_BREAK_CHARACTERS -DHAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS -DHAVE_RL_BASIC_QUOTE_CHARACTERS -DHAVE_RL_COMPLETER_QUOTE_CHARACTERS -DHAVE_RL_FILENAME_QUOTE_CHARACTERS -DHAVE_RL_ATTEMPTED_COMPLETION_OVER -DHAVE_RL_LIBRARY_VERSION -DHAVE_RL_EVENT_HOOK -DHAVE_RL_CLEANUP_AFTER_SIGNAL -DHAVE_RL_CLEAR_SIGNALS -DHAVE_RL_VI_EDITING_MODE -DHAVE_RL_EMACS_EDITING_MODE -DHAVE_REPLACE_HISTORY_ENTRY -DHAVE_REMOVE_HISTORY -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c readline.c readline.c: In function 'readline_readline': readline.c:82: error: 'rb_io_t' undeclared (first use in this function) readline.c:82: error: (Each undeclared identifier is reported only once readline.c:82: error: for each function it appears in.) readline.c:82: error: 'ofp' undeclared (first use in this function) readline.c:82: error: 'ifp' undeclared (first use in this function) make: *** [readline.o] Error 1

The view is stuck now. I missed something else fundamental, what do I need to do the necessary libraries / gem / whatever?

Grateful for any advice - max

SOLUTION: I actually just solved it - I removed the gdp-rb-readline gem, then did the gem install rb-readline , and then added the gem 'rb-readline' to my Gemfile application. I think he just needed to know where to look for reading material if he was not in the usual place. I did not need to do anything with extconf.rb, which is good, because rb-readline gem does not have it.

I left this at the end of my question because: a) someone else could better understand the problem, not my approach to trial and error, and b) in case someone else has a problem.

+6
ruby ruby-on-rails ruby-on-rails-3 readline rvm
source share
2 answers

If you use rvm , you can always use the package installer to fix any problems that your OS may have. Ruby often uses libraries that are slightly different from what you have installed:

 rvm package install readline 

The rvm installer applies several patches to a specific, well-known working version of readline and should build without problems. This readline package will not affect your system installation and is used only for rvm-based builds.

+4
source share
 cd ~/.rvm/src/ruby-XXX-pXXX/ext/readline 

(replace ruby-1.9.2-p180 with your ruby ​​version of the system)

 ruby extconf.rb 

if any check says no, install these packages:

 sudo apt-get install libncurses5-dev libreadline5-dev 

and run ruby extconf.rb

you have to check everything yes

 make make install 

Now it will work.

+3
source share

All Articles