3

UPDATE: I probably messed up my system while trying solutions found somewhere else. I started from scratch and Ruby 1.9.3 installed without a hitch. Now to try to get ree-1.8.7 to play nice alongside...


I'm trying to install Ruby 1.9.3 using RVM on Kubuntu (11.10 I believe). I've been having plenty of issues with Readline so far, but found the answer to all but this one.

I installed Ruby 1.9.3 this way:

rvm install 1.9.3
# Install of ruby-1.9.3-p0 - #complete 
cd ~/.rvm/src/ruby-1.9.3-p0/ext/readline/
~/.rvm/src/ruby-1.9.3-p0/ext/readline $ ../../ruby extconf.rb --with-editline-dir="/usr" --with-readline-dir="/usr"
# any other way of doing this resulted in simply readline not being loaded when trying to start the console
# I have libreadline6 and libreadline6-dev installed (and all the packages requested in `rvm requirements`
make install
# compiling readline.c                                                                                                                                                                                      
# linking shared-object readline.so                                                                                                                                                                         
# /usr/bin/install -c -m 0755 readline.so /home/mbillard/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/x86_64-linux                                                                                    
# installing default readline libraries 

So far everything looks to have run properly but when I try to start the console I get this error:

/home/mbillard/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/completion.rb:9:in `require': /home/mbillard/.rvm/usr/lib/libreadline.so.6: undefined symbol: UP - /home/mbillard/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/x86_64-linux/readline.so (LoadError)
  from /home/mbillard/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
  from /home/mbillard/.rvm/gems/ruby-1.9.3-p0@taskman/gems/railties-3.2.1/lib/rails/commands/console.rb:3:in `require'
  from /home/mbillard/.rvm/gems/ruby-1.9.3-p0@taskman/gems/railties-3.2.1/lib/rails/commands/console.rb:3:in `<top (required)>'
  from /home/mbillard/.rvm/gems/ruby-1.9.3-p0@taskman/gems/railties-3.2.1/lib/rails/commands.rb:38:in `require'
  from /home/mbillard/.rvm/gems/ruby-1.9.3-p0@taskman/gems/railties-3.2.1/lib/rails/commands.rb:38:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'

I tried using rvm install 1.9.3 --with-readline-dir="$rvm_path/usr" and using $rvm_path when compiling Readline in the command above but those resulted in this error:

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

So, thanks for any help you can provide.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
mbillard
  • 38,386
  • 18
  • 74
  • 98

3 Answers3

6

Please read the output of:

rvm requirements

It will show you list of libraries you need to install to make good use of Ruby

After installing all the libs, clean rvm installed libs and reinstall Ruby:

rm -rf $rvm_path/usr
rvm reinstall 1.9.3
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
mpapis
  • 52,729
  • 14
  • 121
  • 158
  • I already did install everything listed in `rvm requirements` as I wrote in my question, I'll check again just to be sure though. – mbillard Feb 14 '12 at 15:54
  • updated, after rereading I found another issue, you had an installation of readline in rvm path, cleaning it will solve your problem (at least it should) – mpapis Feb 14 '12 at 21:11
  • I need my installation of libreadline in $rvm_path because I also use ree-1.8.7 which requires that readline package. – mbillard Feb 14 '12 at 21:43
  • it's what produces issues, on ubuntu readline is good from standard packages and you do not have to use RVM compiled version, just reinstall 1.8.7 also after removing .../usr – mpapis Feb 14 '12 at 21:46
  • I tried removing everything from $rvm_path/usr, removing both my rubies (ree-1.9.7 and ruby-1.9.3), then reinstalling from there, but I still get the same error (and now ree-1.8.7 doesn't work anymore). Thanks for the tips though. – mbillard Feb 15 '12 at 04:55
  • it's not possible to get exactyl the same problem as you have removed the `$rvm_path/usr` and the error was pointing to `/home/mbillard/.rvm/usr/lib/libreadline.so.6` either you missed to remove it or the error msg. changed, please show the new output – mpapis Feb 15 '12 at 11:25
  • you're right, I must have reinstalled the packages after it failed. I tried the above but it fails when reinstalling, it complains about an error in openssl_missing.h `conflicting types for ‘HMAC_CTX_copy’`. I tried 2 other times, once with `--with-readline-dir=/usr/` and the second time I added `--with-openssl-dir=/usr/` with no success. – mbillard Feb 16 '12 at 01:32
  • I think I have messed up my machine by trying all sorts of things, I think I'm gonna reinstall the OS. – mbillard Feb 16 '12 at 04:13
5

You need to install the readline development packages. (This is how my answer differs from the other existing one):

apt-get install libreadline-dev

After doing so, you can reinstall Ruby (as @mpapis already mentioned) and everything should work.

rvm reinstall 1.9.3
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
jupp0r
  • 4,502
  • 1
  • 27
  • 34
  • I already have libreadline6-dev installed, is there a difference? – mbillard Feb 14 '12 at 15:52
  • I installed this package and it fix the problem. @mbillard, on my Ubuntu installation the following dependency packages were also installed along libreadline-dev (libncurses5-dev libreadline-dev libreadline6-dev libtinfo-dev) – Alpha01 Apr 08 '12 at 21:16
1

I had a similar issue. try

brew link readline --force

that worked for me.

I got the solution from here:

Rails Console Not Loading

Community
  • 1
  • 1
izhu613
  • 11
  • 1