web-dev-qa-db-fra.com

Comment obtenir le support Readline dans IRB en utilisant RVM sur Ubuntu 11.10

J'ai essayé tout ce que je pouvais imaginer pour que cela fonctionne, mais en vain je demande ici des suggestions sur la façon de déboguer.

Tout d’abord, exécuter Ubuntu 11.10

Installé rvm:

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

Readline installé en utilisant apt-get:

$ Sudo apt-get install libreadline-dev

Vérifiez l’installation de 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

Installer Ruby, avec un support readline?

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

Voici la version de RVM:

$ rvm --version

rvm 1.9.2 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/]

Essayons le 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

Non, ok, donc si ça ne marchera pas avec la version readline d'ubuntu ??? essayons avec la propre version de readline de rvm:

$ 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

Ok, il y a une erreur, jetons un coup d'oeil:

$ 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

Et comme prévu, irb ne fonctionne pas avec 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 > 

Ai-je installé toutes les conditions requises pour la RVM? Oui, regarde:

$ 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.

Et ainsi de suite, et ainsi de suite, etc.

$ 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

Donc, pour conclure, je serais exceptionnellement reconnaissant si une étincelle brillante pouvait suggérer comment je peux résoudre ce problème et le résoudre.

ps - Oui j'ai "Google" ce problème à mort .... 

30
ktec

Ok, cela peut sembler assez évident, eh bien, c’est toujours le cas lorsque vous connaissez la réponse:

J'ai arrêté d'utiliser RVM et je suis passé à rbenv - ce dont je suis ravi! 

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

Ceci a été installé sans erreur - et je ne suis toujours pas convaincu d'avoir besoin du paquet gplv2 car j'ai installé libreadline6-dev. Cependant, cela n'a toujours PAS résolu mon problème. Il a supprimé RVM de l'équation et m'a montré que malgré tous mes efforts, l'IRB Shell refusait d'utiliser readline.

La réponse est venue de la lecture de ce grand guide:

RubyTools.pdf

Dans mon fichier ~/.irbrc j'ai trouvé:

IRB.conf[:USE_READLINE] = false

Une mise à jour rapide pour:

IRB.conf[:USE_READLINE] = true

Et je cuisine au gaz !!

Merci pour toutes les bonnes réponses et suggestions, j'apprécie votre temps.

11
ktec

Ubuntu 12.04 ici: les réponses ici ont aidé, mais étaient également trompeuses.

Si vous utilisez Ubuntu 12.04, NE PAS installer la lecture, avec ou sans --skip-autoreconf. Cela fait, readline ou zlib sera cassé, quelle que soit la combinaison de commutateurs que vous donnez à rvm install 1.9.3.

Pour que cela fonctionne, faites l'installation d'apt-get que rvm requirements vous dit de faire, faites un pkg uninstall readline puis un simple rvm remove 1.9.3; rvm install 1.9.3

33
Bryan Larsen

J'ai eu du mal avec le même problème avec Ubuntu 11.10.

Dans mon cas, readline semblerait compiler correctement si j’utilisais les éléments suivants:

$ rvm --skip-autoreconf pkg install readline

comme indiqué au bas de http://beginrescueend.com/packages/readline/

Cependant, quand j'appelais irb, j'obtenais l'erreur normale "Impossible de demander readline"

Enfin, basé sur la ligne de commande de Shane, j'ai invoqué ce qui suit:

$ 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

plutôt que la commande mentionnée à http://beginrescueend.com/packages/readline/

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

Dans mon cas, la version 1.9.3 était ce que je voulais. Et enfin irb a créé une ligne de lecture fonctionnelle.

Merci à tous ceux qui sont ici pour m'avoir orienté dans la bonne direction.

12
usonianhorizon

Cela a résolu mon problème de rvm avec Ruby 1.9.3

gem install rb-readline
10
henrybai

J'ai eu le même problème, mais je suis sur 11.04 et de lire le lien que vous avez donné https://github.com/wayneeseguin/rvm/issues/553 Et de l'info dans peplins commenter J'ai supprimé l'appel autoreconf qui a été ajouté ici
https://github.com/wayneeseguin/rvm/commit/94c301d et readline compile maintenant sans erreur. J'ai rajouté l'appel autoreconf après avoir compilé readline avant de réinstaller Ruby. 

Donc, voici comment je me suis fait:

éditez ~/.rvm/scripts/functions/pkg et supprimez les éléments suivants:

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

Compilez readline et supprimez Ruby (j'ai utilisé la commande ree_dependencies mais je ne suis pas sûr que cela soit nécessaire):

rvm pkg install ree_dependencies
rvm remove 1.9.2

annulez votre suppression dans ~/.rvm/scripts/functions/pkg
J'ai ensuite installé 1.9.2 avec cette commande (encore une fois, c’est à partir du fichier d’installation dont je ne suis pas sûr qu’il soit nécessaire, mais c’est ce que j’ai utilisé)

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

et maintenant tout semble fonctionner comme il se doit, espérons que cela aidera quelqu'un.

4
shane

Ma configuration est Ubuntu 11.10, RVM 1.10.2, Ruby 1.9.3.

Ce problème de readline donnait des erreurs lors de l'exécution de irb et empêchait l'exécution de la console Rails en raison de l'erreur suivante:

'require': impossible de charger un tel fichier - readline (LoadError)

La solution qui a fonctionné pour moi était celle décrite par Bryan Larsen, c’est-à-dire.

NE PAS installer la lecture, avec ou sans --skip-autoreconf

Effectuez l’installation d’apt-get selon les exigences de rvm, puis

rvm --skip-autoreconf pkg désinstaller readline

rvm supprimer 1.9.3

rvm installer 1.9.3

Merci pour le conseil Bryan.

2
David Mountain

Ces étapes ont corrigé mon problème (sur un Lubuntu 12.04) après avoir précédemment compilé Ruby et toujours eu l'erreur "Compile readline missing" à chaque fois que j'exécutais:

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
2
punkdata

Vous pouvez essayer une solution de rechange en installant le paquet libreadline5-dev . . Le libreadline6-dev ne fonctionne pas actuellement.

1
Fernando Carvalho

Malheureusement, rien de tout cela n'a fonctionné pour moi. J'ai fini par utiliser le Quick Fix de http://beginrescueend.com/packages/readline/

Cela a résolu mon problème.

1
HannesBenson

Oubliez tout ce que vous entendez de la logique, regardez ici et procédez pas à pas:

  (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

de toute façon trop de fonctions manquantes, mais ... faire ensuite

$ 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 > 

Vous pouvez voir que cela fonctionne bien pour moi.

1 - N'oubliez pas d'installer 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 - désinstaller pkg readline

$ rvm pkg uninstall readline

3 - aller à $ chemin_rvm/src/Ruby - # {version}/ext/readline et faire 

$ Ruby extconf.rb; make; make install

4 - oublier le mal de tête

0
mart7ini

Pour moi, cela fonctionnait parfaitement avec la dernière version de rvm. Mes pas

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

selon 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
0
Michael Franzl

Si vous utilisez Bundler , voici ce qui pourrait vous aider:

echo "gem 'rb-readline'" >> Gemfile
bundle install
0
Vadym Tyemirov