I'm using rails3 for the first time (i've been using rails2 for years) inside an rvm. Trying to start the console, i get this error:
require': no such file to load -- readline
I've googled around and this seems to be a common problem. Most solutions seem to involve 1) installing the following: sudo apt-get install libncurses5-dev libreadline5-dev
2) going to the gem folder for readline, running ruby extconf.rb
which generates a makefile
3) doing make
and make install
Now, i didn't have readline installed in my rvm, so i tried to install it. But couldn't work out what the gem is: gem install readline
doesn't give any results. The only one i found was gem install rdp-rb-readline
. I installed the two dev libraries, installed the rdp-rb-readline gem, went to the subsequent gem folder, and ran ruby extconf.rb
. This did indeed generate 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
Kind of stuck now. Am i missing something else fundamental that i need to make the required libraries/gem/whatever?
Grateful for any advice - max
SOLUTION:
I actually just solved this - i uninstalled the rdp-rb-readline gem, then did gem install rb-readline
, then added gem 'rb-readline'
to my app's Gemfile. I guess it just needed to know where to look for the readline stuff if it wasn't in the usual place. I didn't need to do anything with extconf.rb, which is good because the rb-readline gem doesn't have one.
I've left this at the end of my question because a) someone else might have a better understanding of the problem rather than my trial and error approach and b) in case anyone else has the same problem.
If you're using rvm
, you can always make use of the package installer facility to fix any issues your OS may have. Ruby often uses libraries that are a bit different from what you have installed:
rvm package install readline
The rvm
installer applies several patches against a specific, known-working version of readline and should build without issues. This readline package won't affect your system install, and is used only for rvm-based builds.
cd ~/.rvm/src/ruby-X.X.X-pXXX/ext/readline
(replace ruby-1.9.2-p180 with your system ruby version)
ruby extconf.rb
if any checking says no, install these pakages:
sudo apt-get install libncurses5-dev libreadline5-dev
and run ruby extconf.rb
you should get all checking yes,
make
make install
now it will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With