Solved: Ruby Gem Require LoadError (8-STABLE, Ruby 1.9.1)
Stanislav Sedov
stas at FreeBSD.org
Fri Jan 29 05:27:59 UTC 2010
On Jan 28, 2010, at 8:50 PM, Aaron Gifford wrote:
>
> It looks like ConfigMap[:ruby_install_name] gets set earlier in the
> same gem_prelude.rb code to RbConfig::CONFIG["ruby_install_name"]
> which in turn is set in rbconfig.rb which sets it to "ruby19". That
> file is autogenerated during the build process by the mkconfig.rb
> script which gets passed an "install_name" variable setting I'm
> assuming.
>
> That in turn gets set during make. The Makefile shows:
> $(RBCONFIG): $(srcdir)/mkconfig.rb config.status $(PREP)
> @$(MINIRUBY) $(srcdir)/mkconfig.rb -timestamp=$@ \
> -install_name=$(RUBY_INSTALL_NAME) \
> -so_name=$(RUBY_SO_NAME) rbconfig.rb
>
> So it's getting set to the RUBY_INSTALL_NAME value 'ruby19'. Of
> course Makefile is created from the Makefile.in template by the GNU
> Autoconf configure process. The configure.in template shows
> RUBY_INSTALL_NAME getting set to:
>
> RUBY_INSTALL_NAME="${ri_prefix}ruby${ri_suffix}"
>
> That explains completely how Gem.default_dir is getting set to
> ""/usr/local/lib/ruby19/gems/1.9" instead of the actual path
> "/usr/local/lib/ruby/gems/1.9"
>
> ONE POSSIBLE FIX is this patch to gem_prelude.rb (in
> /usr/ports/lang/ruby19/files/patch-gem_prelude.rb):
> ========================
> --- gem_prelude.rb.orig 2010-01-28 21:22:27.307910440 -0700
> +++ gem_prelude.rb 2010-01-28 21:22:43.177946726 -0700
> @@ -116,7 +116,7 @@
> File.join File.dirname(ConfigMap[:sitedir]), 'Gems',
> ConfigMap[:ruby_version]
> elsif RUBY_VERSION > '1.9' then
> - File.join(ConfigMap[:libdir],
> ConfigMap[:ruby_install_name], 'gems',
> + File.join(ConfigMap[:libdir], 'ruby', 'gems',
> ConfigMap[:ruby_version])
> else
> File.join(ConfigMap[:libdir], ruby_engine, 'gems',
> ========================
>
> This works. Building/installing gems under 1.9.1 (with
> RUBY_VERSION=1.9.1 in /etc/make.conf) did not break (still works), but
> this time, no LoadErrors during require. AT LAST!
>
Hi, Aaron!
Thank you a lot for you analysis!
Your patch looks good! But I think we could just probably remove the
1.9 specific if
clause here, so ruby 1.9 will behave exactly like ruby 1.8 here. Can
you test if the
following patch works for you? Thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ruby19.diff
Type: application/octet-stream
Size: 1348 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ruby/attachments/20100129/ec65da01/ruby19.obj
-------------- next part --------------
More information about the freebsd-ruby
mailing list