簡體   English   中英

如何在Ubuntu 11.10上使用RVM在IRB中獲得Readline支持

[英]How to get Readline support in IRB using RVM on Ubuntu 11.10

我已經嘗試了所有我能想到的工作,但沒有用,所以我在這里請求有關如何調試的建議。

首先,運行Ubuntu 11.10

安裝rvm:

$ bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

使用apt-get安裝的readline:

$ sudo apt-get install libreadline-dev

檢查readline安裝:

$ dpkg --get-selections | grep readline
lib64readline-gplv2-dev             install
lib64readline5                  install
libreadline-dev                 install
libreadline5                    install
libreadline6                    install
libreadline6-dev                install
readline-common                 install

安裝ruby,有readline支持嗎?

$ rvm install 1.9.2 --with-readline-dir=/usr

這是rvm版本:

$ rvm --version

rvm 1.9.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]

讓我們試試ruby shell:

$ irb
1.9.2 :001 > puts "add history"
add history
 => nil 
1.9.2 :002 > ^[[A^[[A^[[A^[[A^[[A <------ PRESS UP ARROW DOES THIS

不,好吧如果它不能用於ubuntu的readline版本??? 讓我們試試rvm自己的readline版本:

$ rvm pkg install readline
Fetching readline-5.2.tar.gz to /home/keith/.rvm/archives
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1989k  100 1989k    0     0   318k      0  0:00:06  0:00:06 --:--:--  418k
Extracting readline-5.2.tar.gz to /home/keith/.rvm/src
Applying patch '/home/keith/.rvm/patches/readline-5.2/shobj-conf.patch'...
Prepare readline in /home/keith/.rvm/src/readline-5.2.
ERROR: Error running 'autoreconf -is --force', please read /home/keith/.rvm/log/readline/autoreconf.log
Configuring readline in /home/keith/.rvm/src/readline-5.2.
Compiling readline in /home/keith/.rvm/src/readline-5.2.
Installing readline to /home/keith/.rvm/usr
Fetching readline-6.2.tar.gz to /home/keith/.rvm/archives
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2224k  100 2224k    0     0   310k      0  0:00:07  0:00:07 --:--:--  444k
Extracting readline-6.2.tar.gz to /home/keith/.rvm/src
Applying patch '/home/keith/.rvm/patches/readline-6.2/patch-shobj-conf.diff'...
Prepare readline in /home/keith/.rvm/src/readline-6.2.
ERROR: Error running 'autoreconf -is --force', please read /home/keith/.rvm/log/readline/autoreconf.log
Configuring readline in /home/keith/.rvm/src/readline-6.2.
Compiling readline in /home/keith/.rvm/src/readline-6.2.
Installing readline to /home/keith/.rvm/usr

好的,那里有一個錯誤,讓我們來看看:

$ more /home/keith/.rvm/log/readline/autoreconf.log
[2011-11-17 22:31:15] autoreconf -is --force
autoheader: warning: missing template: CTYPE_NON_ASCII
autoheader: Use AC_DEFINE([CTYPE_NON_ASCII], [], [Description])
autoheader: warning: missing template: FIONREAD_IN_SYS_IOCTL
autoheader: warning: missing template: HAVE_BSD_SIGNALS
autoheader: warning: missing template: HAVE_GETPW_DECLS
autoheader: warning: missing template: HAVE_LANGINFO_CODESET
autoheader: warning: missing template: HAVE_MBRLEN
autoheader: warning: missing template: HAVE_MBSCMP
autoheader: warning: missing template: HAVE_MBSNRTOWCS
autoheader: warning: missing template: HAVE_MBSRTOWCS
autoheader: warning: missing template: HAVE_MBSTATE_T
autoheader: warning: missing template: HAVE_POSIX_SIGNALS
autoheader: warning: missing template: HAVE_POSIX_SIGSETJMP
autoheader: warning: missing template: HAVE_STRUCT_DIRENT_D_FILENO
autoheader: warning: missing template: HAVE_STRUCT_DIRENT_D_INO
autoheader: warning: missing template: HAVE_USG_SIGHOLD
autoheader: warning: missing template: HAVE_WCRTOMB
autoheader: warning: missing template: HAVE_WCSCOLL
autoheader: warning: missing template: HAVE_WCSDUP
autoheader: warning: missing template: HAVE_WCTYPE
autoheader: warning: missing template: HAVE_WCWIDTH
autoheader: warning: missing template: MUST_REINSTALL_SIGHANDLERS
autoheader: warning: missing template: NO_MULTIBYTE_SUPPORT
autoheader: warning: missing template: SPEED_T_IN_SYS_TYPES
autoheader: warning: missing template: STRCOLL_BROKEN
autoheader: warning: missing template: STRUCT_WINSIZE_IN_SYS_IOCTL
autoheader: warning: missing template: STRUCT_WINSIZE_IN_TERMIOS
autoheader: warning: missing template: TIOCSTAT_IN_SYS_IOCTL
autoheader: warning: missing template: VOID_SIGHANDLER
autoreconf: /usr/bin/autoheader failed with exit status: 1

正如預期的那樣,irb無法使用readline:

$ rvm install 1.8.7 --with-readline-dir=\$HOME/.rvm/usr
Installing Ruby from source to: /home/keith/.rvm/rubies/ruby-1.8.7-p352, this may take a while depending on your cpu(s)...

ruby-1.8.7-p352 - #fetching 
ruby-1.8.7-p352 - #extracting ruby-1.8.7-p352 to /home/keith/.rvm/src/ruby-1.8.7-p352
ruby-1.8.7-p352 - #extracted to /home/keith/.rvm/src/ruby-1.8.7-p352
Applying patch 'stdout-rouge-fix' (located at /home/keith/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch)
ruby-1.8.7-p352 - #configuring 
ruby-1.8.7-p352 - #compiling 
ruby-1.8.7-p352 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.10 for ruby-1.8.7-p352 ...
Installation of rubygems completed successfully.
ruby-1.8.7-p352 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.8.7-p352 - #importing default gemsets (/home/keith/.rvm/gemsets/)
Install of ruby-1.8.7-p352 - #complete 
$ irb
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.beginrescueend.com/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.8.7 :001 > 

我是否安裝了所有rvm要求? 是的,看看:

$ sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
Note, selecting 'libncurses5-dev' instead of 'ncurses-dev'
autoconf is already the newest version.
automake is already the newest version.
bison is already the newest version.
build-essential is already the newest version.
curl is already the newest version.
git-core is already the newest version.
libc6-dev is already the newest version.
libncurses5-dev is already the newest version.
libreadline6 is already the newest version.
libreadline6-dev is already the newest version.
libreadline6-dev set to manually installed.
libsqlite3-0 is already the newest version.
libsqlite3-dev is already the newest version.
libssl-dev is already the newest version.
libtool is already the newest version.
libxml2-dev is already the newest version.
libxslt1-dev is already the newest version.
libyaml-dev is already the newest version.
openssl is already the newest version.
sqlite3 is already the newest version.
subversion is already the newest version.
zlib1g is already the newest version.
zlib1g-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

所以它繼續下去,一直持續......

$ rvm remove 1.8.7
Removing /home/keith/.rvm/src/ruby-1.8.7-p352...
Removing /home/keith/.rvm/rubies/ruby-1.8.7-p352...
Removing ruby-1.8.7-p352 aliases...
Removing ruby-1.8.7-p352 wrappers...
Removing ruby-1.8.7-p352 environments...
Removing ruby-1.8.7-p352 binaries...

$ rvm install 1.8.7 --with-readline-dir=\$HOME/.rvm/usr
Installing Ruby from source to: /home/keith/.rvm/rubies/ruby-1.8.7-p352, this may take a while depending on your cpu(s)...

ruby-1.8.7-p352 - #fetching 
ruby-1.8.7-p352 - #extracting ruby-1.8.7-p352 to /home/keith/.rvm/src/ruby-1.8.7-p352
ruby-1.8.7-p352 - #extracted to /home/keith/.rvm/src/ruby-1.8.7-p352
Applying patch 'stdout-rouge-fix' (located at /home/keith/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch)
ruby-1.8.7-p352 - #configuring 
ruby-1.8.7-p352 - #compiling 
ruby-1.8.7-p352 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.10 for ruby-1.8.7-p352 ...
Installation of rubygems completed successfully.
ruby-1.8.7-p352 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.8.7-p352 - #importing default gemsets (/home/keith/.rvm/gemsets/)
Install of ruby-1.8.7-p352 - #complete 

$ irb
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.beginrescueend.com/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.8.7 :001 > 

$ cd ~/.rvm/src/ruby-1.8.7-p352/ext/readline/
$ ruby extconf.rb 
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... yes
checking for rl_filename_completion_function()... yes
checking for rl_username_completion_function()... yes
checking for rl_completion_matches()... yes
checking for rl_deprep_term_function in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completion_append_character in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_basic_word_break_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completer_word_break_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_basic_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completer_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_filename_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_attempted_completion_over in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_library_version in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_event_hook in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_cleanup_after_signal()... yes
checking for rl_clear_signals()... yes
checking for rl_vi_editing_mode()... yes
checking for rl_emacs_editing_mode()... yes
checking for replace_history_entry()... yes
checking for remove_history()... yes
creating Makefile

$ make
gcc -shared -o readline.so readline.o -L. -L/home/keith/.rvm/rubies/ruby-1.8.7-p352/lib -Wl,-R/home/keith/.rvm/rubies/ruby-1.8.7-p352/lib -L.  -rdynamic -Wl,-export-dynamic    -Wl,-R -Wl,/home/keith/.rvm/rubies/ruby-1.8.7-p352/lib -L/home/keith/.rvm/rubies/ruby-1.8.7-p352/lib -lruby -lreadline -lncurses  -lrt -ldl -lcrypt -lm   -lc

$ make install
/usr/bin/install -c -m 0755 readline.so /home/keith/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/i686-linux

$ rvm remove 1.8.7
Removing /home/keith/.rvm/src/ruby-1.8.7-p352...
Removing /home/keith/.rvm/rubies/ruby-1.8.7-p352...
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Removing ruby-1.8.7-p352 aliases...
Removing ruby-1.8.7-p352 wrappers...
Removing ruby-1.8.7-p352 environments...
Removing ruby-1.8.7-p352 binaries...

$ rvm install 1.8.7 --with-readline-dir=\$HOME/.rvm/usr
Installing Ruby from source to: /home/keith/.rvm/rubies/ruby-1.8.7-p352, this may take a while depending on your cpu(s)...
ruby-1.8.7-p352 - #fetching 
ruby-1.8.7-p352 - #extracting ruby-1.8.7-p352 to /home/keith/.rvm/src/ruby-1.8.7-p352
ruby-1.8.7-p352 - #extracted to /home/keith/.rvm/src/ruby-1.8.7-p352
Applying patch 'stdout-rouge-fix' (located at /home/keith/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch)
ruby-1.8.7-p352 - #configuring 
ruby-1.8.7-p352 - #compiling 
ruby-1.8.7-p352 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.10 for ruby-1.8.7-p352 ...
Installation of rubygems completed successfully.
ruby-1.8.7-p352 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.8.7-p352 - #importing default gemsets (/home/keith/.rvm/gemsets/)
Install of ruby-1.8.7-p352 - #complete 

$ irb
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.beginrescueend.com/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.8.7 :001 > $ 

$ rvm pkg install readline
Fetching readline-5.2.tar.gz to /home/keith/.rvm/archives
Extracting readline-5.2.tar.gz to /home/keith/.rvm/src
Applying patch '/home/keith/.rvm/patches/readline-5.2/shobj-conf.patch'...
Prepare readline in /home/keith/.rvm/src/readline-5.2.
ERROR: Error running 'autoreconf -is --force', please read /home/keith/.rvm/log/readline/autoreconf.log
Configuring readline in /home/keith/.rvm/src/readline-5.2.
Compiling readline in /home/keith/.rvm/src/readline-5.2.
Installing readline to /home/keith/.rvm/usr
Fetching readline-6.2.tar.gz to /home/keith/.rvm/archives
Extracting readline-6.2.tar.gz to /home/keith/.rvm/src
Applying patch '/home/keith/.rvm/patches/readline-6.2/patch-shobj-conf.diff'...
Prepare readline in /home/keith/.rvm/src/readline-6.2.
ERROR: Error running 'autoreconf -is --force', please read /home/keith/.rvm/log/readline/autoreconf.log
Configuring readline in /home/keith/.rvm/src/readline-6.2.
Compiling readline in /home/keith/.rvm/src/readline-6.2.
Installing readline to /home/keith/.rvm/usr

$ sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
Note, selecting 'libncurses5-dev' instead of 'ncurses-dev'
autoconf is already the newest version.
automake is already the newest version.
bison is already the newest version.
build-essential is already the newest version.
curl is already the newest version.
git-core is already the newest version.
libc6-dev is already the newest version.
libncurses5-dev is already the newest version.
libreadline6 is already the newest version.
libreadline6-dev is already the newest version.
libreadline6-dev set to manually installed.
libsqlite3-0 is already the newest version.
libsqlite3-dev is already the newest version.
libssl-dev is already the newest version.
libtool is already the newest version.
libxml2-dev is already the newest version.
libxslt1-dev is already the newest version.
libyaml-dev is already the newest version.
openssl is already the newest version.
sqlite3 is already the newest version.
subversion is already the newest version.
zlib1g is already the newest version.
zlib1g-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ cd ~/.rvm/src/ruby-1.8.7-p352/ext/readline/

$ ruby extconf.rb --with-readline-dir=/usr
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... yes
checking for rl_filename_completion_function()... yes
checking for rl_username_completion_function()... yes
checking for rl_completion_matches()... yes
checking for rl_deprep_term_function in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completion_append_character in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_basic_word_break_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completer_word_break_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_basic_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completer_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_filename_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_attempted_completion_over in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_library_version in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_event_hook in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_cleanup_after_signal()... yes
checking for rl_clear_signals()... yes
checking for rl_vi_editing_mode()... yes
checking for rl_emacs_editing_mode()... yes
checking for replace_history_entry()... yes
checking for remove_history()... yes
creating Makefile

$ make
gcc -I. -I. -I/home/keith/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/i686-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 -I/usr/include  -D_FILE_OFFSET_BITS=64  -fPIC -g -O2  -fPIC   -c readline.c
gcc -shared -o readline.so readline.o -L. -L/home/keith/.rvm/rubies/ruby-1.8.7-p352/lib -Wl,-R/home/keith/.rvm/rubies/ruby-1.8.7-p352/lib -L/usr/lib -Wl,-R/usr/lib -L.  -rdynamic -Wl,-export-dynamic    -Wl,-R -Wl,/home/keith/.rvm/rubies/ruby-1.8.7-p352/lib -L/home/keith/.rvm/rubies/ruby-1.8.7-p352/lib -lruby -lreadline -lncurses  -lrt -ldl -lcrypt -lm   -lc

$ make install
/usr/bin/install -c -m 0755 readline.so /home/keith/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/i686-linux

$ irb
ruby-1.8.7-p352 :001 > p 1
1
 => nil 
ruby-1.8.7-p352 :002 > $   

$ rvm remove 1.8.7
Removing /home/keith/.rvm/src/ruby-1.8.7-p352...
Removing /home/keith/.rvm/rubies/ruby-1.8.7-p352...
Removing ruby-1.8.7-p352 aliases...
Removing ruby-1.8.7-p352 wrappers...
Removing ruby-1.8.7-p352 environments...
Removing ruby-1.8.7-p352 binaries...

$ rvm install 1.8.7 --with-readline-dir=/usr
Installing Ruby from source to: /home/keith/.rvm/rubies/ruby-1.8.7-p352, this may take a while depending on your cpu(s)...

ruby-1.8.7-p352 - #fetching 
ruby-1.8.7-p352 - #extracting ruby-1.8.7-p352 to /home/keith/.rvm/src/ruby-1.8.7-p352
ruby-1.8.7-p352 - #extracted to /home/keith/.rvm/src/ruby-1.8.7-p352
Applying patch 'stdout-rouge-fix' (located at /home/keith/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch)
ruby-1.8.7-p352 - #configuring 
ruby-1.8.7-p352 - #compiling 
ruby-1.8.7-p352 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.10 for ruby-1.8.7-p352 ...
Installation of rubygems completed successfully.
ruby-1.8.7-p352 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.8.7-p352 - #importing default gemsets (/home/keith/.rvm/gemsets/)
Install of ruby-1.8.7-p352 - #complete 

$ irb
1.8.7 :001 > p "hello world"
"hello world"
 => nil 
1.8.7 :002 > ^[[A^[[A^[[A^[[A^[[A

總而言之,如果一些明亮的火花可以暗示我如何調試這種情況並解決,我將非常感激。

ps - 是的我有“谷歌”這個問題要死了....

Ubuntu 12.04在這里:這里的答案有所幫助,但也有誤導性。

如果您使用的是Ubuntu 12.04,請不要使用或不使用--skip-autoreconf來安裝readline。 完成后,無論你給rvm install 1.9.3提供什么樣的開關組合,readline或zlib都會被破壞。

要使它工作,請執行rvm requirements告訴你的apt-get安裝,執行pkg uninstall readline ,然后執行一個簡單的rvm remove 1.9.3; rvm install 1.9.3 rvm remove 1.9.3; rvm install 1.9.3

我在使用Ubuntu 11.10時遇到了同樣的問題。

在我的情況下,如果我使用以下內容,readline似乎可以正確編譯:

$ rvm --skip-autoreconf pkg install readline

http://beginrescueend.com/packages/readline/底部所述

但是,當我調用irb時,我會得到正常錯誤“Unable to required readline”

最后,根據Shane的命令行,我調用了以下內容:

$ rvm install 1.9.3 --with-readline-dir=$rvm_usr_path --with-iconv-dir=$rvm_usr_path --with-zlib-dir=$rvm_usr_path --with-openssl-dir=$rvm_usr_path

而不是http://beginrescueend.com/packages/readline/上提到的命令

$ rvm install 1.9.2 --with-readline-dir=$rvm_path/usr

在我的情況下,版本1.9.3是我想要的。 最后, irb提出了一個有效的讀數。

感謝大家在這里指出我正確的方向。

好的,所以這看起來很明顯,當你知道答案的時候總是如此:

我放棄了使用RVM,並切換到rbenv - 我很高興我做到了!

sudo apt-get install libreadline-gplv2-dev
CONFIGURE_OPTS="--with-readline-dir=/usr/include/readline --with-openssl-dir=/usr/local" rbenv-install 1.9.2-p290

這安裝沒有錯誤 - 我仍然不相信我需要gplv2包,因為我已經安裝了libreadline6-dev。 然而,STILL並沒有解決我的問題。 它確實從等式中刪除了RVM,並告訴我,盡管我盡了最大的努力,IRB shell拒絕使用readline。

答案來自閱讀這篇偉大的指南:

RubyTools.pdf

在我的〜/ .irbrc文件中,我發現:

IRB.conf[:USE_READLINE] = false

快速更新:

IRB.conf[:USE_READLINE] = true

我正在烹飪燃氣!

感謝所有偉大的答案和建議,我非常感謝您的時間。

這解決了我使用Ruby 1.9.3進行rvm的問題

gem install rb-readline

我有同樣的問題,但我在11.04並且從閱讀你給的鏈接https://github.com/wayneeseguin/rvm/issues/553並從peplins的信息評論那里我刪除了這里添加的autoreconf調用
https://github.com/wayneeseguin/rvm/commit/94c301d現在readline編譯沒有任何錯誤。 在我再次安裝ruby之前編譯readline后,我在autoreconf調用中添加了回來。

所以這就是我的工作方式:

編輯〜/ .rvm / scripts / functions / pkg並刪除以下內容:

if [[ "${rvm_skip_autoreconf_flag:-0}" == 0 ]] &&
  which autoreconf >/dev/null 2>&1 &&
  which libtoolize >/dev/null 2>&1 &&
  [[ -f configure.ac || -f configure.in ]]
then
__rvm_run "$package/autoreconf" \
  "autoreconf -is --force" \
  "Prepare $package in $rvm_src_path/$package-$version."
fi

編譯readline並刪除ruby(我使用了ree_dependencies命令,但我不確定這是否必要):

rvm pkg install ree_dependencies
rvm remove 1.9.2

撤消刪除到〜/ .rvm / scripts / functions / pkg
然后我用這個命令安裝了1.9.2(再次來自ree安裝,我不確定是否有必要,但這是我使用的)

rvm install 1.9.2 --with-readline-dir=$rvm_usr_path --with-iconv-dir=$rvm_usr_path --with-zlib-dir=$rvm_usr_path --with-openssl-dir=$rvm_usr_path

現在所有人似乎都應該工作,希望能幫助某人。

我的設置是ubuntu 11.10,RVM 1.10.2,ruby 1.9.3。

這個readline問題在運行irb時出錯,並且由於錯誤導致無法運行rails控制台:

'require':無法加載此類文件 - readline(LoadError)

對我有用的解決方案是Bryan Larsen描述的解決方案,即

不要使用或不使用--skip-autoreconf來安裝readline

然后,執行rvm要求告訴你的apt-get安裝

rvm --skip-autoreconf pkg卸載readline

rvm刪除1.9.3

rvm install 1.9.3

對於小費布萊恩而言。

這些步驟修復了我的問題(在Lubuntu 12.04上)之前編譯ruby並且在我運行的任何時候不斷得到“編譯讀取線丟失”錯誤:

sudo aptitude install build-essential openssl libreadline6 \
                      libreadline6-dev curl git-core zlib1g zlib1g-dev \
                      libssl-dev libyaml-dev libsqlite3-dev sqlite3 \
                      libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev \
                      automake libtool bison subversion
rvm pkg uninstall readline
rvm remove 1.9.3
rvm install 1.9.3

您可以嘗試安裝包libreadline5-dev的workarround。 我發現libreadline6-dev現在不能正常工作。

不幸的是,這些都不適合我。 我最終使用http://beginrescueend.com/packages/readline/上的快速修復程序

這解決了我的問題。

忘掉你聽到的關於任何邏輯的一切,只需看看這里並一步一步地做同樣的事情:

  (ubuntu x64):

 $ ruby extconf.rb 
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

$ sudo aptitude install libedit-dev
..

$ ruby extconf.rb
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... yes
checking for rl_getc_function() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_filename_completion_function() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_username_completion_function() in stdio.h,readline/readline.h,readline/history.h... no
checking for rl_completion_matches() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_refresh_line() in stdio.h,readline/readline.h,readline/history.h... no
checking for rl_deprep_term_function in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completion_append_character in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_basic_word_break_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completer_word_break_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_basic_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completer_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_filename_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_attempted_completion_over in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_library_version in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_editing_mode in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_line_buffer in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_point in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_event_hook in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_catch_sigwinch in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_catch_signals in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_cleanup_after_signal() in stdio.h,readline/readline.h,readline/history.h... no
checking for rl_clear_signals() in stdio.h,readline/readline.h,readline/history.h... no
checking for rl_set_screen_size() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_get_screen_size() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_vi_editing_mode() in stdio.h,readline/readline.h,readline/history.h... no
checking for rl_emacs_editing_mode() in stdio.h,readline/readline.h,readline/history.h... no
checking for replace_history_entry() in stdio.h,readline/readline.h,readline/history.h... no
checking for remove_history() in stdio.h,readline/readline.h,readline/history.h... yes
checking for clear_history() in stdio.h,readline/readline.h,readline/history.h... yes
checking for RL_PROMPT_START_IGNORE in stdio.h,readline/readline.h,readline/history.h... yes
checking for RL_PROMPT_END_IGNORE in stdio.h,readline/readline.h,readline/history.h... yes
creating Makefile

無論如何太多缺少功能,但......接下來做

$ rvm pkg uninstall readline
...
╰─○ ruby extconf.rb                                                    
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... yes
checking for rl_getc_function() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_filename_completion_function() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_username_completion_function() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completion_matches() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_refresh_line() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_deprep_term_function in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completion_append_character in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_basic_word_break_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completer_word_break_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_basic_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completer_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_filename_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_attempted_completion_over in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_library_version in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_editing_mode in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_line_buffer in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_point in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_event_hook in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_catch_sigwinch in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_catch_signals in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_cleanup_after_signal() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_clear_signals() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_set_screen_size() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_get_screen_size() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_vi_editing_mode() in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_emacs_editing_mode() in stdio.h,readline/readline.h,readline/history.h... yes
checking for replace_history_entry() in stdio.h,readline/readline.h,readline/history.h... yes
checking for remove_history() in stdio.h,readline/readline.h,readline/history.h... yes
checking for clear_history() in stdio.h,readline/readline.h,readline/history.h... yes
checking for RL_PROMPT_START_IGNORE in stdio.h,readline/readline.h,readline/history.h... yes
checking for RL_PROMPT_END_IGNORE in stdio.h,readline/readline.h,readline/history.h... yes
creating Makefile
$ make
compiling readline.c
linking shared-object readline.so
$ make install
/usr/bin/install -c -m 0755 readline.so /home/sky/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/x86_64-linux
installing default readline libraries



irb
1.9.3-p194 :001 > 

你可以看到它對我來說很好。

1 - 別忘了安裝libedit-dev

# dpkg --get-selections| egrep '(readline|libedit)'
libedit-dev                                     install # <= BSD PACKAGE, not GNU, but... it is work fine to me
libedit2                                        install # the same story as previous
libreadline-dev                                 install
libreadline5                                    install
libreadline6                                    install
libreadline6-dev                                install
readline-common                                 install

2 - 卸載pkg readline

$ rvm pkg uninstall readline

3 - 轉到$ rvm_path / src / ruby​​ - #{version} / ext / readline並執行

$ ruby extconf.rb; make; make install

4 - 忘記頭痛

如果您使用的是Bundler,則以下內容可能有所幫助:

echo "gem 'rb-readline'" >> Gemfile
bundle install

對我來說,它只是開箱即用的最新版本的rvm。 我的步驟

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )

根據rvm requirements

apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion

rvm install 1.9.3

rvm

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM