Problems with the rails console, RVM and readline

前端 未结 7 519
谎友^
谎友^ 2020-12-04 11:40

I\'ve installed rvm as a way of making sure that my local development version of ruby is the same as my server\'s for a particular app i work on (ruby 1.8.7). I\'ve done th

相关标签:
7条回答
  • 2020-12-04 11:50

    I had a similar problem it was with 1.9.2 on Ubuntu 10.04, but the symptoms were identical. In order to get it to work:

    rvm pkg install readline
    

    or prior to RVM version 1.6.32, you need the following command

    rvm package install readline
    

    Then:

    apt-get install ncurses-dev
    

    And then taking from their instructions at http://rvm.beginrescueend.com/packages/readline/

    cd $HOME/.rvm/src/ruby-1.9.2-p0/ext/readline
    ruby extconf.rb -- --with-readline-dir="$HOME/.rvm/usr"
    make install
    

    I had actually done a system rvm install on the server, so I needed to do this:

    cd $HOME/.rvm/src/ruby-1.9.2-p0/ext/readline
    ruby extconf.rb -- --with-readline-dir="/usr/local/rvm/usr"
    make install
    

    After that I was able to have full access to the console.

    0 讨论(0)
  • 2020-12-04 11:50

    Run the command

    rvm requirements
    

    It shows the requirements and dependencies. Install those and reinstall the ruby on rvm

    rvm remove 1.9.2
    rvm install 1.9.2
    

    It works!

    0 讨论(0)
  • 2020-12-04 11:53

    Tried gem install rb-readline

    Still did not work. So started irb and did a require readline. The error message helped.

        Readline was unable to be required, if you need completion or history install readline then reinstall the ruby.
    You may follow 'rvm notes' for dependencies and/or read the docs page https://rvm.io/packages/readline/ . Be sure you 'rvm remove X ; rvm install X' to re-compile your ruby with readline support after obtaining the readline libraries.
    1.9.3p327 :001 > require 'readline'
    LoadError: /usr/local/lib/libreadline.so.6: undefined symbol: UP - /home/sudhir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/x86_64-linux/readline.so
        from /home/sudhir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/sudhir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from (irb):1
        from /home/sudhir/.rvm/rubies/ruby-1.9.3-p327/bin/irb:16:in `<main>'
    1.9.3p327 :002 > ^[[6^[[A^[[A^[[B^C^C
    

    So the problem in my case was all the libreadline* in /usr/local/lib. I had installed readline from source code and that was messing it up.

    Followed the instructions here to fix it. http://vkarthickeyan.wordpress.com/2012/02/16/mysql-symbol-lookup-error-usrlocalliblibreadline-so-6-undefined-symbol-up/

    0 讨论(0)
  • 2020-12-04 11:56

    I got same problem and solved it. I check http://rvm.beginrescueend.com/packages/readline/ Please check follow 2 things:

    1. sudo aptitude install libreadline5-dev libncurses5-dev use libreadline6-dev, if you have a new version.
    2. ruby extconf.rb -- --with-readline-dir='/home/youruser/.rvm/usr/include/readline' make sure you have the readline lib files under the with-readline-dir you pointed.
    0 讨论(0)
  • 2020-12-04 12:12

    Have you trying this tutorial to use the readline install by brew ?

    http://blog.plataformatec.com.br/2010/05/accented-chars-in-irb-with-rvm-and-ruby-1-8-7/

    0 讨论(0)
  • 2020-12-04 12:13
    Readline was unable to be required, if you need completion or history install readline then reinstall the ruby.
    You may follow 'rvm notes' for dependencies and/or read the docs page https://rvm.io/packages/readline/ . Be sure you 'rvm remove X ; rvm install X' to re-compile your ruby with readline support after obtaining the readline libraries.
    

    If you follow that link, you will find some instructions on how to fix this problem. What worked for me was the first step, removing all the manually installed packages:

     $ rm -rf $rvm_path/usr
    

    and then

    $ rvm requirements
    $ rvm reinstall 1.9.3
    

    Hope it works!

    0 讨论(0)
提交回复
热议问题