Newbie installation problem: libraries?

P

Paul Emmons

I have recently installed ruby-1.8.1 on my Mandrake Linux system.

Everything seems to be working except any programs with "require",
such as irb requiring "irb".

I hope this is just a matter of ruby not finding its libraries, which
are actually here somewhere.

Do you know how I can correct this problem?

Thanks.
 
T

Tim Hunter

I have recently installed ruby-1.8.1 on my Mandrake Linux system.

Everything seems to be working except any programs with "require", such as
irb requiring "irb".

I hope this is just a matter of ruby not finding its libraries, which are
actually here somewhere.

Do you know how I can correct this problem?

Thanks.

Ruby searches a default list of directories. You can see
that list by entering this command:

ruby -e 'puts $:.join("\n")'

On my Mandrake system the output looks like this:

/usr/local/lib/ruby/site_ruby/1.8
/usr/local/lib/ruby/site_ruby/1.8/i686-linux
/usr/local/lib/ruby/site_ruby
/usr/local/lib/ruby/1.8
/usr/local/lib/ruby/1.8/i686-linux

The exact list you see depends on how you installed Ruby. If you compiled
from source, it should look pretty much like mine. If you installed from
an .rpm, the prefix is probably '/usr' instead of '/usr/local' (assuming
you took the default).

Look in those directories to make sure everything looks okay. If not, try
to determine what went wrong during the install. Did you get any error
messages? How did you install? From source, or from an rpm?
 
J

Joel VanderWerf

Paul said:
I have recently installed ruby-1.8.1 on my Mandrake Linux system.

That's what I've got, and installing is always painless, at least when
starting from source. Did you install from the tarball or from a rpm?
Everything seems to be working except any programs with "require",
such as irb requiring "irb".

Is this your error message?

ruby: No such file to load -- irb (LoadError)

You can do the following to see where ruby is looking for libs:

$ ruby -e 'puts $LOAD_PATH'
 
P

Paul Emmons

ruby -e 'puts $:.join("\n")'

On my Mandrake system the output looks like this:

/usr/local/lib/ruby/site_ruby/1.8
/usr/local/lib/ruby/site_ruby/1.8/i686-linux
/usr/local/lib/ruby/site_ruby
/usr/local/lib/ruby/1.8
/usr/local/lib/ruby/1.8/i686-linux

Yes, that's what I see; but most of these directories are empty.
/usr/local/lib/ruby/site_ruby/1.8/i686-linux has:
config.h rbconfig.rb

and that's all.

I installed from a tarball. Is an RPM easier?

When I first ran CONFIGURE, it exited and closed out my whole
terminal. Perhaps I misunderstood the "run ./configure" in the
README. It's executable, so I should have typed "configure" rather
than ". configure".

Then I discovered from the log file that a file or two needed to be in
a different directory than it was in. I'm afraid I can't recall what
these files were or where I had to copy them.

I could start all over if I were sure how to uninstall first. Would
that be make realclean?

Thank you for replying, and so quickly!
 
J

Joel VanderWerf

Paul said:
When I first ran CONFIGURE, it exited and closed out my whole
terminal. Perhaps I misunderstood the "run ./configure" in the
README. It's executable, so I should have typed "configure" rather
than ". configure".

I would unpack the tarball again and then try this:

/configure
make
su
make install
 
P

Paul Emmons

I would unpack the tarball again and then try this:

/configure
make
su
make install
During make install, I got:
../instruby.rb:138: private method `sub!' called for nil:NilClass
(NoMethodError)
from ./instruby.rb:134:in `open'
from ./instruby.fb:134
from ./instruby.rb:121:in `each'
from ./instruby.rb:121
make: *** [install] Error 1
 
T

Tim Hunter

I installed from a tarball. Is an RPM easier?

Sometimes, but since you already have the tarball let's stick with that.
Echoing Joel's advice:

1. unpack the tarball
2. cd into the top directory
3. ./configure
4. make
5. su
6. make install

Everything should be copacetic.

P.S. I'm assuming that you took all the defaults before.
 
B

Bret Jolly

Paul Emmons said:
I have recently installed ruby-1.8.1 on my Mandrake Linux system.

Everything seems to be working except any programs with "require",
such as irb requiring "irb".

I hope this is just a matter of ruby not finding its libraries, which
are actually here somewhere.

Do you know how I can correct this problem?

Thanks.
People have already noted how you can find what path is
automatically used by ruby, e.g., by
ruby -e 'puts $LOAD_PATH'

To change this, you can set the shell environment variable RUBYLIB.
For example, in my .bashrc on one of the computers I use, I have the
lines:
RUBYLIB="$HOME/comp_lang/ruby/nucm:$HOME/comp_lang/ruby/pnom"
export RUBYLIB

This allows me to require files in ~/comp_lang/ruby/nucm and
~/comp_lang/ruby/pnom without explicitly giving the directory.
If I run a script in my home directory with the line:
require 'nucm_utils'

This loads the file ~/comp_lang/ruby/nucm/nucm_utils.rb into ruby.

Regards, Bret
 
P

Paul Emmons

I would unpack the tarball again and then try this:

/configure
make
su
make install

It worked this time!
I unpacked the tarball into a totally new place. When I unpacked it
into the directories it had already been unpacked in before, it didn't
work.

Thank you!

How long should all these unpacked files and subdirectories stay? Is
is o.k. to delete them and just keep the tarball (and maybe some log
files?)
 
T

Tim Hunter

How long should all these unpacked files and subdirectories stay? Is is
o.k. to delete them and just keep the tarball (and maybe some log files?)

It's okay to delete them now. You can always get the tarball again from
the same place you got it from this time.

P.S.
If you want to read the source code to the Ruby translator, then you
should keep the unpacked source files.
 
P

Paul Emmons

It's okay to delete them now. You can always get the tarball again from
the same place you got it from this time.

P.S.
If you want to read the source code to the Ruby translator, then you
should keep the unpacked source files.

Oh, I always keep the tarballs-- if not on the hard disk, then on some
backup medium. I'm a pack rat :)

But thank you! I gather that the procedure people have described for
installing Ruby is pretty standard for tarballs, right (I'm pretty new
at this).
 

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,146
Messages
2,570,832
Members
47,374
Latest member
anuragag27

Latest Threads

Top