Ruby from source and then from apt

J

Jonas Pfenniger

Hello ruby community,

I have a curious behavior, but I suspect it's because of my lack of
knowledge about ruby.

I'm working on an Ubuntu machine, and I wanted the latest from ruby, so
I compiled it and make install'ed it. After some time using it with no
problem, I changed my mind because some ruby extensions are just easier
to install with apt-get. I've started to remove the ruby executable and
it's friends in /usr/local/bin, so that `which ruby` gives
me /usr/bin/ruby.

The problem is, that I still have the hand-compiled version hanging
around my system and it causes some problems. For example if I run irb :
irb(main):001:0> puts $LOAD_PATH
/usr/local/lib/site_ruby/1.8
/usr/local/lib/site_ruby/1.8/i386-linux
/usr/local/lib/site_ruby
/usr/lib/ruby/1.8
/usr/lib/ruby/1.8/i386-linux
 
S

Stefan Lang

Hello ruby community,

I have a curious behavior, but I suspect it's because of my lack of
knowledge about ruby.

I'm working on an Ubuntu machine, and I wanted the latest from ruby, so
I compiled it and make install'ed it. After some time using it with no
problem, I changed my mind because some ruby extensions are just easier
to install with apt-get. I've started to remove the ruby executable and
it's friends in /usr/local/bin, so that `which ruby` gives
me /usr/bin/ruby.

The problem is, that I still have the hand-compiled version hanging
around my system and it causes some problems. For example if I run irb :
irb(main):001:0> puts $LOAD_PATH
/usr/local/lib/site_ruby/1.8
/usr/local/lib/site_ruby/1.8/i386-linux
/usr/local/lib/site_ruby
/usr/lib/ruby/1.8
/usr/lib/ruby/1.8/i386-linux
.
=> nil

Do you know how to remove the compiled ruby version, or make that the
debian package overrides the old configuration ?
For me worked:
% rm /usr/local/bin/ruby
% rm /usr/local/bin/irb
% rm /usr/local/bin/ri
% rm /usr/local/bin/testrb
% rm -rf /usr/local/lib/ruby

I wonder where the /usr/local/lib/site_ruby directory comes from.
On my system this is /usr/local/lib/ruby/site_ruby and I've done a
normal ./configure; make; make install of Ruby 1.8.
So perhaps you also want to
% rm -rf /usr/local/lib/site_ruby

Stefan
 
J

Jonas Pfenniger

Le Mon, 30 May 2005 23:06:23 +0900, Stefan Lang a écrit :
For me worked:
% rm /usr/local/bin/ruby
% rm /usr/local/bin/irb
% rm /usr/local/bin/ri
% rm /usr/local/bin/testrb
% rm -rf /usr/local/lib/ruby

I wonder where the /usr/local/lib/site_ruby directory comes from.
On my system this is /usr/local/lib/ruby/site_ruby and I've done a
normal ./configure; make; make install of Ruby 1.8.
So perhaps you also want to
% rm -rf /usr/local/lib/site_ruby

Stefan


Hi Stefan,

Thanks a lot for your help. It was kinda fuzzy in my head, but
because you fortified my sight of the problem, I get nearer to it. In the
fact /usr/local/lib/site_ruby is created by the rubygems install script,
so it's fine for me (I think).

The real problem is that I installed some gems like `og`, but irb can't
find the include path to use it :

irb(main):001:0> require 'og'
LoadError: No such file to load -- og
from (irb):1:in `require'
from (irb):1


irb(main):001:0> require_gem 'og'
NoMethodError: undefined method `require_gem' for main:Object
from (irb):1

It looks like gem has some problems.
I had to compile it from souce (latest from rubyforge) because ubuntu
doesn't have the gem package. Here are the compile options, it looks all
right for me, but maybe I missed something :

ruby setup.rb show
prefix /usr
bindir $prefix/bin
libdir $prefix/lib
datadir $prefix/share
mandir $prefix/share/man
sysconfdir /etc
stdruby $libdir/ruby/1.8
siteruby $prefix/local/lib/site_ruby
siterubyver $siteruby/1.8
siterubyverarch $siterubyver/i386-linux
rbdir $siterubyver
sodir $siterubyverarch
rubypath /usr/bin/ruby1.8
rubyprog /usr/bin/ruby1.8
makeprog make
shebang ruby
without-ext no

I did `sudo ruby setup.rb all` to install it.

I guess I'm not really good at describing the problems.. The subject would
more be like : rubygems not working with ubuntu's ruby package.

Thanks again and have a nice day,
zimba
 
S

Stefan Lang

]
The real problem is that I installed some gems like `og`, but irb can't
find the include path to use it :

irb(main):001:0> require 'og'
LoadError: No such file to load -- og
=A0 =A0 =A0 =A0 from (irb):1:in `require'
=A0 =A0 =A0 =A0 from (irb):1


irb(main):001:0> require_gem 'og'
NoMethodError: undefined method `require_gem' for main:Object
=A0 =A0 =A0 =A0 from (irb):1

You have to load rubygems before you can use installed gems.
require 'rubygems'
# The rubygems script has modified the require method and
# defined the require_gem method.
require 'og'
# or require_gem 'og'

The reason for this is that gems aren't installed in standard
Ruby library pathes.

Stefan
 

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
474,172
Messages
2,570,934
Members
47,478
Latest member
ReginaldVi

Latest Threads

Top