Readline not working with Ruby

S

Stewart

Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard. Any
suggestions?
 
P

Pascal J. Bourguignon

Stewart said:
Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard. Any
suggestions?

Identify the terminal (emulator) that you use and set the TERM
environment variable correctly.

If you change it, use tset to reset the terminal.

Launch irb. readline should use the TERM environment variable to
parse the right control codes from the terminal keyboard and send the
right control codes to the terminal screen.
 
M

Marvin Gülker

Stewart said:
Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard. Any
suggestions?

No suggestions, but I have this problem too:

irb
irb(main):001:0> puts "Test"
Test
=> nil
irb(main):002:0> ^[[A

ruby -v: ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]

Marvin
 
B

Brian Candler

Stewart said:
Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard. Any
suggestions?

You need the readline development libraries installed at the time when
you run ./configure. If you're under Linux, the package will be called
something like libreadline5-dev (Ubuntu/Debian) or readline-devel
(RedHat or other RPM-based distro)

If that's not the problem, then you'll need to be more specific. What OS
are you on? What version of ruby are you building? What makes you think
you built readline support successfully? Look through
ext/readline/mkmf.log to see why the extension wasn't built, and post it
here if you don't understand it.
 
S

Stewart

Identify  the  terminal (emulator)  that  you  use  and set  the  TERM
environment variable correctly.

If you change it, use tset to reset the terminal.

Launch irb.  readline should use the TERM environment variable to
parse the right control codes from the terminal keyboard and send the
right control codes to the terminal screen.


Not sure what you mean by "terminal (emulator)" could you explain in a
little more detail what you mean.
 
T

Thomas Preymesser

[Note: parts of this message were removed to make it a legal post.]

2009/8/11 Stewart said:
Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard. Any
suggestions?
i had the same problem. going to the ext/readline directory and 'make' and
'make install' solved the problem for me.

-Thomas



--
Thomas Preymesser
(e-mail address removed)
http://thopre.googlepages.com/
http://thopre.wordpress.com/

Ogden Nash <http://www.brainyquote.com/quotes/authors/o/ogden_nash.html> -
"The trouble with a kitten is that when it grows up, it's always a cat."
 
S

Stewart

You need the readline development libraries installed at the time when
you run ./configure. If you're under Linux, the package will be called
something like libreadline5-dev (Ubuntu/Debian) or readline-devel
(RedHat or other RPM-based distro)

If that's not the problem, then you'll need to be more specific. What OS
are you on? What version of ruby are you building? What makes you think
you built readline support successfully? Look through
ext/readline/mkmf.log to see why the extension wasn't built, and post it
here if you don't understand it.

Sorry I should have posted more info

ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]

on mac os 10.5

I downloaded readline and compiled it my self. Then i compiled ruby.
So I would suggest its there and working but I am not sure. I think it
might be a linkage issue. Where can i find ext/readline/mkmf.log ?
 
R

Robert Dober

i had the same problem. going to the ext/readline directory and 'make' an= d
'make install' solved the problem for me.
And I recompiled everything after having installed libreadline5-dev.
Well I guess this is safer and that is what make is for after all.
Brian: I would only rerun ./configure if really necessary because that
recompiles everything, but that at least is the bullet proof method
;).
Cheers
Robert
-Thomas



--
Thomas Preymesser
(e-mail address removed)
http://thopre.googlepages.com/
http://thopre.wordpress.com/

Ogden Nash <http://www.brainyquote.com/quotes/authors/o/ogden_nash.html> = =C2=A0-
"The trouble with a kitten is that when it grows up, it's always a cat."



--=20
module Kernel
alias_method :=CE=BB, :lambda
end
 
S

Stewart

/usr/local/src/ruby-1.8.7-p72/ext/readline $ make
make: Nothing to be done for `all'.
/usr/local/src/ruby-1.8.7-p72/ext/readline $ make install
make: Nothing to be done for `install'.
/usr/local/src/ruby-1.8.7-p72/ext/readline $ ls
Makefile README README.ja depend extconf.rb readline.bundle
readline.c readline.o
/usr/local/src/ruby-1.8.7-p72/ext/readline $

Did not do anything Does not seem anything was made.


[Note:  parts of this message were removed to make it a legal post.]

2009/8/11 Stewart <[email protected]>


Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard.  Any
suggestions?

i had the same problem. going to the ext/readline directory and 'make' and
'make install' solved the problem for me.

-Thomas

--
Thomas Preymesser
[email protected]://thopre.googlepages.com/http://thopre.wordpress.com/

Ogden Nash <http://www.brainyquote.com/quotes/authors/o/ogden_nash.html>  -
"The trouble with a kitten is that when it grows up, it's always a cat."
 
B

Brian Candler

Stewart said:
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]

on mac os 10.5

I downloaded readline and compiled it my self. Then i compiled ruby.
So I would suggest its there and working but I am not sure.

Did you install readline after compiling it? I imagine that ruby
couldn't find wherever readline decided to install its header files.

Say if those files went into /usr/local/include, then you could try
setting

export CPPFLAGS="-I/usr/local/include -L/usr/local/lib"

before running ./configure
I think it
might be a linkage issue. Where can i find ext/readline/mkmf.log ?

cd /the/source/directory/where/you/built/ruby
cd ext/readline
ls
cat mkmf.log
 
P

Pascal J. Bourguignon

Stewart said:
Not sure what you mean by "terminal (emulator)" could you explain in a
little more detail what you mean.

http://en.wikipedia.org/wiki/Computer_terminal
http://tldp.org/HOWTO/Text-Terminal-HOWTO.html

You would use readline only when you're using the program thru a text
terminal interface. (eg. if you use irb thru emacs run-ruby command,
then you don't need readline because you have emacs editing commands
instead).

Nowadays, the most probable is that you are actually using a terminal
emulator, that takes input from your console keyboard and displays
output in a GUI window, but still communicating with the application
thru the serial I/O device drivers like a terminal. You still have
all the constraints of a terminal, including that of knowing exactly
what control codes are sent over the serial channel to represent key
presses, and what control codes are sent to the screen to control it
(cursor movement, character decorations, character displayed, etc).
 
P

Pascal J. Bourguignon

Marvin Gülker said:
Stewart said:
Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard. Any
suggestions?

No suggestions, but I have this problem too:

irb
irb(main):001:0> puts "Test"
Test
=> nil
irb(main):002:0> ^[[A

ruby -v: ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]

type in the shell:

echo $TERM

and compare with the actual terminal (or terminal emulator) that you are using.
 
J

James Gray

You need the readline development libraries installed at the time
when
you run ./configure. If you're under Linux, the package will be
called
something like libreadline5-dev (Ubuntu/Debian) or readline-devel
(RedHat or other RPM-based distro)

If that's not the problem, then you'll need to be more specific.
What OS
are you on? What version of ruby are you building? What makes you
think
you built readline support successfully? Look through
ext/readline/mkmf.log to see why the extension wasn't built, and
post it
here if you don't understand it.

Sorry I should have posted more info

ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]

on mac os 10.5

I'm pretty sure it's not even needed on Mac OS 10.5, as it ships with
libedit for a compatible replacement. It won't hurt anything though,
of course.

What happens if you start irb like this?

irb --readline

James Edward Gray II
 
S

Stewart

Stewart said:
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]
on mac os 10.5
I downloaded readline and compiled it my self. Then i compiled ruby.
So I would suggest its there and working but I am not sure.

Did you install readline after compiling it? I imagine that ruby
couldn't find wherever readline decided to install its header files.

Say if those files went into /usr/local/include, then you could try
setting

export CPPFLAGS="-I/usr/local/include -L/usr/local/lib"

before running ./configure
I think it
might be a linkage issue. Where can i find ext/readline/mkmf.log ?

cd /the/source/directory/where/you/built/ruby
cd ext/readline
ls
cat mkmf.log

There is no mkmf.log file in that directory. When you say
run .configure do you mean in the base src folder where i downloaded
ruby?
 
P

Pascal J. Bourguignon

Stewart said:
You need the readline development libraries installed at the time when
you run ./configure. If you're under Linux, the package will be called
something like libreadline5-dev (Ubuntu/Debian) or readline-devel
(RedHat or other RPM-based distro)

If that's not the problem, then you'll need to be more specific. What OS
are you on? What version of ruby are you building? What makes you think
you built readline support successfully? Look through
ext/readline/mkmf.log to see why the extension wasn't built, and post it
here if you don't understand it.

Sorry I should have posted more info

ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]

on mac os 10.5

This is not enough information. What terminal emulator do you use?
Is it Terminal.app? Is it AquaTerm.app? Is it another MacOSX application?
Is it an xterm in X11.app? or some other X terminal emulator?
Or do you use a Linux console or another X terminal emulator running
on Linux, and connect to MacOSX thru ssh?
 
R

Robert Dober

Marvin G=C3=BClker said:
Stewart said:
Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard. =C2=A0Any
suggestions?

No suggestions, but I have this problem too:

irb
irb(main):001:0> puts "Test"
Test
=3D> nil
irb(main):002:0> ^[[A

ruby -v: ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]

type in the shell:

=C2=A0 echo $TERM

and compare with the actual terminal (or terminal emulator) that you are = using.

I strongly suggest to check if your readline extension really compiled
before explorating the unlikely path of terminal issues
type

ruby -rreadline -e 'p 42"

and only if that works explore Pascal's idea.
HTH
Robert

--=20
module Kernel
alias_method :=CE=BB, :lambda
end
 
S

Stewart

No suggestions, but I have this problem too:
irb
irb(main):001:0> puts "Test"
Test
=> nil
irb(main):002:0> ^[[A
ruby -v: ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]

type in the shell:

   echo $TERM

and compare with the actual terminal (or terminal emulator) that you are using.

Ah ok. I see I am using ASCI or that is what my term value is set to.
I am using a macbook so i am just using the default terminal for the
mac. How do i know what hte correct value of term is?
 
S

Stewart

Sorry I should have posted more info
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]
on mac os 10.5

I'm pretty sure it's not even needed on Mac OS 10.5, as it ships with  
libedit for a compatible replacement.  It won't hurt anything though,  
of course.

What happens if you start irb like this?

   irb --readline

James Edward Gray II

/usr/local/src/ruby-1.8.7-p72/ext/readline $ irb --readline
irb(main):001:0>
 
S

Stewart

Stewart wrote:
Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard.  Any
suggestions?
No suggestions, but I have this problem too:
irb
irb(main):001:0> puts "Test"
Test
=> nil
irb(main):002:0> ^[[A
ruby -v: ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]
type in the shell:
  echo $TERM
and compare with the actual terminal (or terminal emulator) that you are using.

I strongly suggest to check if your readline extension really compiled
before explorating the unlikely path of terminal issues
type

ruby -rreadline -e 'p 42"

and only if that works explore Pascal's idea.
HTH
Robert

/usr/local/src/ruby-1.8.7-p72/ext/readline $ ruby -rreadline -e 'p 42'
/usr/local/ruby_test/lib/ruby/site_ruby/1.8/i686-darwin9.6.0/
readline.bundle: dlopen(/usr/local/ruby_test/lib/ruby/site_ruby/1.8/
i686-darwin9.6.0/readline.bundle, 9): Symbol not found:
_rl_filename_completion_function (LoadError)
Referenced from: /usr/local/ruby_test/lib/ruby/site_ruby/1.8/i686-
darwin9.6.0/readline.bundle
Expected in: flat namespace
- /usr/local/ruby_test/lib/ruby/site_ruby/1.8/i686-darwin9.6.0/
readline.bundle
 
J

James Gray

Stewart wrote:
Hey I compiled ruby with readline support. However when i go to
IRB i
just get jibbrish when i press the up arrow on my keyboard. Any
suggestions?
You need the readline development libraries installed at the time
when
you run ./configure. If you're under Linux, the package will be
called
something like libreadline5-dev (Ubuntu/Debian) or readline-devel
(RedHat or other RPM-based distro)
If that's not the problem, then you'll need to be more specific.
What OS
are you on? What version of ruby are you building? What makes you
think
you built readline support successfully? Look through
ext/readline/mkmf.log to see why the extension wasn't built, and
post it
here if you don't understand it.
Sorry I should have posted more info
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]
on mac os 10.5

I'm pretty sure it's not even needed on Mac OS 10.5, as it ships with
libedit for a compatible replacement. It won't hurt anything though,
of course.

What happens if you start irb like this?

irb --readline

James Edward Gray II

/usr/local/src/ruby-1.8.7-p72/ext/readline $ irb --readline
irb(main):001:0>

And do the editing keys now work as expected?

James Edward Gray II
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,734
Latest member
manin

Latest Threads

Top