[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to get "irb1.8" using Ruby1.8 instead of Ruby1.9.1 ?

Iñaki Baz Castillo

4/4/2009 7:47:00 PM

Hi, in Debian I've ruby1.8 (/usr/bin/ruby1.8) and irb1.8 installed as DEB=20
packages, and Ruby 1.9.1 installed from sources, so /usr/bin/ruby is Ruby=20
1.9.1.

When I run "irb1.8" it uses Ruby 1.9.1:

~$ irb1.8
irb> RUBY_VERSION
"1.9.1"

How could I get irb1.8 using Ruby 1.8? I see no options using irb arguments=
,=20
do I miss something?

Thanks.

=2D-=20
I=C3=B1aki Baz Castillo <ibc@aliax.net>

27 Answers

Igor Pirnovar

4/4/2009 11:09:00 PM

0

What you are saying is very likely incorrect. You or someone else must
have screwed up the links to ruby and irb in {{ /usr/bin }}. If you do
the following you should get a similar result as I will list below:

$ cd /usr/bin/
$ ls -l ruby*
lrwxrwxrwx 1 root root 7 2009-02-27 13:52 ruby -> ruby1.8
-rwxr-xr-x 1 root root 3564 2008-10-09 20:19 ruby1.8
lrwxrwxrwx 1 root root 7 2008-10-28 12:51 ruby1.8-old-LINK ->
ruby1.8
-rwxr-xr-x 1 root root 3676 2008-01-24 07:02 ruby1.9
-rwxr-xr-x 1 root root 6320 2007-12-07 05:09
ruby-glade-create-template

$ ls -l irb*
lrwxrwxrwx 1 root root 6 2008-10-28 13:15 irb -> irb1.9
-rwxr-xr-x 1 root root 376 2008-10-09 20:14 irb1.8
-rwxr-xr-x 1 root root 376 2008-01-24 06:54 irb1.9

As you see {{ ruby }} and {[ irb }} should be symbolic links to their
respective version binaries. To change the the behavior you can change
these links.

For instance If I wish to make my {{ irb }} to point to {{ 1.8 irb }}, I
would do the following as {{ root }} or with the help of {{ sudo }}:

1) mv /usr/irb /usr/irb.old
2) ln -s /usr/bin/irb1.8 /usr/irb

If you are not sure you understand the above procedure I suggest you do
not do anything on your own without some more help from people on the
forum. For starters you should post the results of the following here:

$ cd /usr/bin/
$ ls -l ruby*
$ ls -l irb*
--
Posted via http://www.ruby-....

Igor Pirnovar

4/4/2009 11:22:00 PM

0

Oops, I made a mistake above. Here is the correction:

For instance If I wish to make my {{ irb }} to point to {{ 1.8 irb }}, I
would do the following as {{ root }} or with the help of {{ sudo }}:

1) mv /usr/bin/irb /usr/irb.old
2) ln -s /usr/bin/irb1.8 /usr/bin/irb
--
Posted via http://www.ruby-....

Iñaki Baz Castillo

4/4/2009 11:58:00 PM

0

El Domingo 05 Abril 2009, Igor Pirnovar escribi=C3=B3:
> What you are saying is very likely incorrect. You or someone else must
> have screwed up the links to ruby and irb in {{ /usr/bin }}. If you do
> the following you should get a similar result as I will list below:
>
> $ cd /usr/bin/
> $ ls -l ruby*
> lrwxrwxrwx 1 root root 7 2009-02-27 13:52 ruby -> ruby1.8
> -rwxr-xr-x 1 root root 3564 2008-10-09 20:19 ruby1.8
> lrwxrwxrwx 1 root root 7 2008-10-28 12:51 ruby1.8-old-LINK ->
> ruby1.8
> -rwxr-xr-x 1 root root 3676 2008-01-24 07:02 ruby1.9
> -rwxr-xr-x 1 root root 6320 2007-12-07 05:09
> ruby-glade-create-template
>
> $ ls -l irb*
> lrwxrwxrwx 1 root root 6 2008-10-28 13:15 irb -> irb1.9
> -rwxr-xr-x 1 root root 376 2008-10-09 20:14 irb1.8
> -rwxr-xr-x 1 root root 376 2008-01-24 06:54 irb1.9

This is not what I clearly explained in my mail.
As I explained, I've Ruby1.8 and irb1.8 installed as DEB package, but I=20
installed Ruby1.9.1 from sources setting "--prefix=3D/usr/bin", getting:

/usr/bin$ ls -l ruby*
=2Drwxr-xr-x 1 root root 5,4M 2009-03-30 22:47 ruby*
=2Drwxr-xr-x 1 root root 6,1K 2009-01-25 03:04 ruby1.8*
lrwxrwxrwx 1 root root 4 2009-03-30 22:55 ruby1.9 -> ruby*

/usr/bin$ ls -l irb*
lrwxrwxrwx 1 root root 6 2009-03-28 14:16 irb -> irb1.8*
=2Drwxr-xr-x 1 root root 314 2009-03-30 22:48 irb1.8*


This is:
=2D /usr/bin/ruby1.8 is the executable of Ruby 1.8.
=2D /usr/bin/ruby is the executable of Ruby 1.9.1.
=2D /usr/bin/ruby1.9 is a softlink to /usr/bin/ruby.



> As you see {{ ruby }} and {[ irb }} should be symbolic links to their
> respective version binaries. To change the the behavior you can change
> these links.

Not in my case as I've explained above.


> For instance If I wish to make my {{ irb }} to point to {{ 1.8 irb }}, I
> would do the following as {{ root }} or with the help of {{ sudo }}:
>
> 1) mv /usr/irb /usr/irb.old
> 2) ln -s /usr/bin/irb1.8 /usr/irb
>
> If you are not sure you understand the above procedure I suggest you do
> not do anything on your own without some more help from people on the
> forum. For starters you should post the results of the following here:

Sorry, but I do *really* know what a symbolic link is. Please re-read my fi=
rst=20
mail before assuming I'm a starter.

However I found my problem.

irb1.9 exists after compiling Ruby1.9.1 in /usr/src/ruby1.9.1-xxx/bin/irb

In /usr/bin I had:
=2D /usr/bin/irb --> /usr/bin/irb1.8
=2D /usr/bin/irb1.8

So when I installed Ruby1.9.1, /usr/bin/irb was replaced by the Ruby1.9=20
version, this is, /usr/bin/irb1.8 pointed then to irb compiled in Ruby1.9.1.

I've solved it by copying the compiled irb (Ruby1.9) as /usr/bin/irb1.9 and=
=20
re-installing the Debian irb1.8 package, so /usr/bin/irb1.8 is replaced aga=
in.

Now:

~# irb1.8
irb(main):001:0> RUBY_VERSION
"1.8.7"

~# irb1.9
irb(main):001:0> RUBY_VERSION
"1.9.1"


=2D-=20
I=C3=B1aki Baz Castillo <ibc@aliax.net>

Igor Pirnovar

4/5/2009 12:14:00 AM

0

Iñaki Baz Castillo wrote:

> /usr/bin$ ls -l ruby*
> -rwxr-xr-x 1 root root 5,4M 2009-03-30 22:47 ruby*
> -rwxr-xr-x 1 root root 6,1K 2009-01-25 03:04 ruby1.8*
> lrwxrwxrwx 1 root root 4 2009-03-30 22:55 ruby1.9 -> ruby*

Your symbolic link here is clearly wrong. If you didn't make a mistake
writing I am sure it is the source of all your problems. {{ ruby }}
should point to {{ ruby1.9 }} and not as is shown in your post above.

The correct link should be:

lrwxrwxrwx 1 root root 4 2009-03-30 22:55 ruby -> ruby1.9
--
Posted via http://www.ruby-....

Iñaki Baz Castillo

4/5/2009 12:22:00 AM

0

El Domingo 05 Abril 2009, Igor Pirnovar escribi=C3=B3:
> I=C3=B1aki Baz Castillo wrote:
> > /usr/bin$ ls -l ruby*
> > -rwxr-xr-x 1 root root 5,4M 2009-03-30 22:47 ruby*
> > -rwxr-xr-x 1 root root 6,1K 2009-01-25 03:04 ruby1.8*
> > lrwxrwxrwx 1 root root 4 2009-03-30 22:55 ruby1.9 -> ruby*
>
> Your symbolic link here is clearly wrong. If you didn't make a mistake
> writing I am sure it is the source of all your problems. {{ ruby }}
> should point to {{ ruby1.9 }} and not as is shown in your post above.

That makes sense, but when I installed Ruby1.9.1 from sources, the binary i=
t=20
creates was:
/usr/bin/ruby

and I did a symbolic link:
/usr/bin/ruby1.9 --> /usr/bin/ruby

(yes, I could rename ruby as ruby1.9 and create a link "ruby").


=2D-=20
I=C3=B1aki Baz Castillo <ibc@aliax.net>

Ken Bloom

4/5/2009 3:52:00 AM

0

On Sat, 04 Apr 2009 14:47:27 -0500, Iñaki Baz Castillo wrote:

> Hi, in Debian I've ruby1.8 (/usr/bin/ruby1.8) and irb1.8 installed as
> DEB packages, and Ruby 1.9.1 installed from sources, so /usr/bin/ruby is
> Ruby 1.9.1.
>
> When I run "irb1.8" it uses Ruby 1.9.1:
>
> ~$ irb1.8
> irb> RUBY_VERSION
> "1.9.1"
>
> How could I get irb1.8 using Ruby 1.8? I see no options using irb
> arguments, do I miss something?
>
> Thanks.


Please tell me what the shebang in irb1.8 is, by running

head /usr/bin/irb1.8

(On my system, it says #!/usr/bin/ruby1.8, so this whole situation you're
in should be impossible.)

By the way, the better solution would have been to install Ruby 1.9.1
from experimental, rather than from the upstream sources. I'm not sure
what they're waiting for to put it in unstable.

--Ken

--
Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu...

Iñaki Baz Castillo

4/5/2009 12:30:00 PM

0

El Domingo 05 Abril 2009, Ken Bloom escribi=C3=B3:
> Please tell me what the shebang in irb1.8 is, by running
>
> head /usr/bin/irb1.8
>
> (On my system, it says #!/usr/bin/ruby1.8, so this whole situation you're
> in should be impossible.)

Thanks. As I've explained in this thread, I had Ruby1.8 installed as DEB=20
package (so irb was a link to irb1.8).
When compiling and installing Ruby1.9.1 from sources, it created /usr/bin/r=
uby=20
and /usr/bin/irb.
But it's strange since /usr/bin/irb was a softlink and after Ruby 1.9.1=20
install it remains being a softlink to irb1.8, but irb1.8 is now a copy of =
the=20
installed irb (Ruby 1.9.1).


> By the way, the better solution would have been to install Ruby 1.9.1
> from experimental, rather than from the upstream sources. I'm not sure
> what they're waiting for to put it in unstable.

I'm using it in Debian Etch and Ubuntu Jaunty. Ruby1.9.1 doesn't no exist i=
n=20
those distributions. Installing Ruby 1.9.1 from experimental in my Debian E=
tch=20
would require upgrading my system to sid/experimental and I cannot do it.

Thanks a lot for your help.


=2D-=20
I=C3=B1aki Baz Castillo <ibc@aliax.net>

Rick DeNatale

4/5/2009 1:54:00 PM

0

On Sun, Apr 5, 2009 at 8:29 AM, I=F1aki Baz Castillo <ibc@aliax.net> wrote:

> El Domingo 05 Abril 2009, Ken Bloom escribi=F3:
> > Please tell me what the shebang in irb1.8 is, by running
> >
> > head /usr/bin/irb1.8
> >
> > (On my system, it says #!/usr/bin/ruby1.8, so this whole situation you'=
re
> > in should be impossible.)
>
> Thanks. As I've explained in this thread, I had Ruby1.8 installed as DEB
> package (so irb was a link to irb1.8).
> When compiling and installing Ruby1.9.1 from sources, it created
> /usr/bin/ruby
> and /usr/bin/irb.
> But it's strange since /usr/bin/irb was a softlink and after Ruby 1.9.1
> install it remains being a softlink to irb1.8, but irb1.8 is now a copy o=
f
> the
> installed irb (Ruby 1.9.1).


The Debian packaging system relies on users not installing stuff in the sam=
e
places that the packager does. /usr/bin is one of those places.

When you are installing source on a Debian based system (which would includ=
e
Ubuntu) you need to put it somewhere else., like /usr/local/bin, so instead
of just
/configure
make
sudo make install

you need to do something like

/configure --prefix=3D/usr/local/ruby1.9
make
sudo make install

I think you need to somehow force the system to reinstall the ruby 1.8
package(s), then install 1.9 from source to a safe place.

Rick DeNatale

4/5/2009 1:59:00 PM

0

On Sun, Apr 5, 2009 at 9:53 AM, Rick DeNatale <rick.denatale@gmail.com>wrot=
e:

> On Sun, Apr 5, 2009 at 8:29 AM, I=F1aki Baz Castillo <ibc@aliax.net> wrot=
e:
>
> > El Domingo 05 Abril 2009, Ken Bloom escribi=F3:
> > > Please tell me what the shebang in irb1.8 is, by running
> > >
> > > head /usr/bin/irb1.8
> > >
> > > (On my system, it says #!/usr/bin/ruby1.8, so this whole situation
> you're
> > > in should be impossible.)
> >
> > Thanks. As I've explained in this thread, I had Ruby1.8 installed as DE=
B
> > package (so irb was a link to irb1.8).
> > When compiling and installing Ruby1.9.1 from sources, it created
> > /usr/bin/ruby
> > and /usr/bin/irb.
> > But it's strange since /usr/bin/irb was a softlink and after Ruby 1.9.1
> > install it remains being a softlink to irb1.8, but irb1.8 is now a copy
> of
> > the
> > installed irb (Ruby 1.9.1).
>
>
> The Debian packaging system relies on users not installing stuff in the
> same
> places that the packager does. /usr/bin is one of those places.
>
> When you are installing source on a Debian based system (which would
> include
> Ubuntu) you need to put it somewhere else., like /usr/local/bin, so inste=
ad
> of just
> ./configure
> make
> sudo make install
>
> you need to do something like
>
> ./configure --prefix=3D/usr/local/ruby1.9
> make
> sudo make install
>
> I think you need to somehow force the system to reinstall the ruby 1.8
> package(s), then install 1.9 from source to a safe place.
>

An afterthought, that configure command should probably be
/configure --prefix=3D/usr/local/ruby1.9 --program-suffix=3D1.9

the second option will turn the ruby, irb and other executables into
ruby1.9, irb1.9 etc rather than just
ruby, irb...

--=20
Rick DeNatale

Blog: http://talklikeaduck.denh...
Twitter: http://twitter.com/Ri...
WWR: http://www.workingwithrails.com/person/9021-ric...
LinkedIn: http://www.linkedin.com/in/ri...

Iñaki Baz Castillo

4/5/2009 2:38:00 PM

0

El Domingo 05 Abril 2009, Rick DeNatale escribi=C3=B3:
> The Debian packaging system relies on users not installing stuff in the
> same places that the packager does. /usr/bin is one of those places.
>
> When you are installing source on a Debian based system (which would
> include Ubuntu) you need to put it somewhere else., like /usr/local/bin

Yes, you are completely right. I expected installation from sources to crea=
te=20
ruby1.9 and irb1.9 by default, so I didn0t care about using /usr/bin=20
directory, but I was wrong.


> I think you need to somehow force the system to reinstall the ruby 1.8
> package(s), then install 1.9 from source to a safe place.

Yes, that's what I did so irb1.8 was correctly replaced again.

Thanks a lot.


=2D-=20
I=C3=B1aki Baz Castillo <ibc@aliax.net>