Ruby Gem Require LoadError (8-STABLE, Ruby 1.9.1)

Aaron Gifford astounding at gmail.com
Fri Jan 29 01:54:44 UTC 2010


On Thu, Jan 28, 2010 at 5:50 PM, Stanislav Sedov <stas at freebsd.org> wrote:
> On Thu, 28 Jan 2010 17:11:53 -0700
> Aaron Gifford <astounding at gmail.com> mentioned:
>
>> 2010/1/28 Stanislav Sedov <stas at freebsd.org> said:
>> > Oh, so you have ruby 1.9 as a default version?
>>
>> Yes, I manually symlinked all /usr/local/bin/*19 executables to make
>> 1.9 my default ruby.  (I much prefer 1.9 :)
>>
>
> Oh, that might be a problem.  Use RUBY_VER=1.9 in make.conf instead.

I'll immediately give that a try.  However, it seems that it ought NOT
to be an issue, as I didn't symlink stuff until AFTER I built and
installed ruby 1.9.1 AND all the ports (gems).  Only THEN did I create
the symlinks.

Oh, okay.  I get it.  By default, the ruby based ports are expecting
to be installed with 1.8, and even though the build and install WORKS
with 1.9, since I did not set RUBY_VER to 1.9 in make.conf when I
built them. So something somewhere is still thinking "1.8" whether or
not 1.8 even existed (and it did not on my system).


I just uninstalled all gems and ruby related ports, then rebuilt with
RUBY_VER=1.9 in /etc/make.conf.  NOTE: The net/ssh gem was rebuilt and
reinstalled with the ports system.  The mtik gem was directly
installed with 'gem19 install mtik-3.0.1.gem' from the command-line.
I wanted to see if installation method made a different.

ALSO when make was building/installing the gems, I noted these lines
in the output:

===>  Cleaning for rubygem-net-ssh-2.0.15
===>  Vulnerability check disabled, database not found
===>  Extracting for rubygem-net-ssh-2.0.15
=> MD5 Checksum OK for rubygem/net-ssh-2.0.15.gem.
=> SHA256 Checksum OK for rubygem/net-ssh-2.0.15.gem.
===>   rubygem-net-ssh-2.0.15 depends on file: /usr/local/bin/ruby19 - found
===>  Patching for rubygem-net-ssh-2.0.15
===>   rubygem-net-ssh-2.0.15 depends on file: /usr/local/bin/ruby19 - found
===>   rubygem-net-ssh-2.0.15 depends on file: /usr/local/bin/ruby19 - found
===>  Configuring for rubygem-net-ssh-2.0.15
===>  Installing for rubygem-net-ssh-2.0.15
===>   rubygem-net-ssh-2.0.15 depends on file: /usr/local/bin/ruby19 - found
===>   Generating temporary packing list
===>  Checking if security/rubygem-net-ssh already installed
/usr/bin/env  /usr/local/bin/gem19 install -l --no-update-sources
--no-ri --install-dir /usr/local/lib/ruby/gems/1.9
/var/ports/distfiles/rubygem/net-ssh-2.0.15.gem   -- --build-args
Successfully installed net-ssh-2.0.15
1 gem installed
Installing RDoc documentation for net-ssh-2.0.15...
===>   Registering installation for rubygem-net-ssh-2.0.15

Looking at the above install, the 'gem19' install looks like I think
it ought to.


NOW FOR the BIG TEST:

user at host:/home/user% irb19
irb(main):001:0> require 'net/ssh'
LoadError: no such file to load -- net/ssh
        from (irb):1:in `require'
        from (irb):1
        from /usr/local/bin/irb19:12:in `<main>'
irb(main):002:0> require 'mtik'
LoadError: no such file to load -- mtik
        from (irb):2:in `require'
        from (irb):2
        from /usr/local/bin/irb19:12:in `<main>'
irb(main):003:0> gem 'net-ssh'
Gem::LoadError: Could not find RubyGem net-ssh (>= 0)

        from <internal:gem_prelude>:244:in `push_gem_version_on_load_path'
        from <internal:gem_prelude>:14:in `gem'
        from (irb):3
        from /usr/local/bin/irb19:12:in `<main>'
irb(main):004:0> gem 'mtik'
Gem::LoadError: Could not find RubyGem mtik (>= 0)

        from <internal:gem_prelude>:244:in `push_gem_version_on_load_path'
        from <internal:gem_prelude>:14:in `gem'
        from (irb):4
        from /usr/local/bin/irb19:12:in `<main>'
irb(main):005:0> require 'rubygems'
=> true
irb(main):006:0> require 'mtik'
LoadError: no such file to load -- mtik
        from (irb):6:in `require'
        from (irb):6
        from /usr/local/bin/irb19:12:in `<main>'
irb(main):007:0> require 'net/ssh'
LoadError: no such file to load -- net/ssh
        from (irb):7:in `require'
        from (irb):7
        from /usr/local/bin/irb19:12:in `<main>'
irb(main):008:0> gem 'mtik'
=> true
irb(main):009:0> require 'mtik'
=> true
irb(main):010:0> require 'net/ssh'
LoadError: no such file to load -- net/ssh
        from (irb):10:in `require'
        from (irb):10
        from /usr/local/bin/irb19:12:in `<main>'
irb(main):011:0> gem 'net-ssh'
=> true
irb(main):012:0> require 'net/ssh'
=> true
irb(main):013:0>



Argh!  The same problem.

So I removed all ruby ports and tried yet again using
RUBY_DEFAULT_VER=1.9 in /etc/make.conf.  Output of the build looked
similar (as above).  And the end result was identical: all attempts to
require the ports failed.



A HA!

This helps:

GEM_HOME=/usr/local/lib/ruby/gems/1.9/ irb19
irb(main):001:0> require 'net/ssh'
=> true

So if I manually set $GEM_HOME, things work.

Any ideas what might be happening, anyone?

Aaron out.


P.S.
Thanks for your help, Stanislav.  I appreciate your suggestions.


More information about the freebsd-ruby mailing list