Date: Thu, 28 Jan 2010 21:27:52 -0800 From: Stanislav Sedov <stas@FreeBSD.org> To: Aaron Gifford <astounding@gmail.com> Cc: freebsd-ruby@freebsd.org Subject: Re: Solved: Ruby Gem Require LoadError (8-STABLE, Ruby 1.9.1) Message-ID: <5C9D0969-7B42-4788-AFB9-303772A0043F@FreeBSD.org> In-Reply-To: <e58000751001282050n4c92c3b5pddfb549af1b75050@mail.gmail.com> References: <e58000751001282050n4c92c3b5pddfb549af1b75050@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail-3-820347370 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit 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! --Apple-Mail-3-820347370 Content-Disposition: attachment; filename=ruby19.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="ruby19.diff" Content-Transfer-Encoding: 7bit Index: Mk/bsd.ruby.mk =================================================================== RCS file: /home/pcvs/ports/Mk/bsd.ruby.mk,v retrieving revision 1.192 diff -u -r1.192 bsd.ruby.mk --- Mk/bsd.ruby.mk 6 Jan 2010 06:31:20 -0000 1.192 +++ Mk/bsd.ruby.mk 29 Jan 2010 05:23:12 -0000 @@ -198,7 +198,7 @@ # Ruby 1.9 # RUBY_RELVERSION= 1.9.1 -RUBY_PORTREVISION= 0 +RUBY_PORTREVISION= 1 RUBY_PORTEPOCH= 1 RUBY_PATCHLEVEL= 376 Index: lang/ruby19/files/patch-gem_prelude.rb =================================================================== RCS file: lang/ruby19/files/patch-gem_prelude.rb diff -N lang/ruby19/files/patch-gem_prelude.rb --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lang/ruby19/files/patch-gem_prelude.rb 29 Jan 2010 05:23:12 -0000 @@ -0,0 +1,12 @@ +--- gem_prelude.rb.orig 2010-01-29 08:19:47.000000000 +0300 ++++ gem_prelude.rb 2010-01-29 08:20:04.000000000 +0300 +@@ -115,9 +115,6 @@ + if defined? RUBY_FRAMEWORK_VERSION then + 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', +- ConfigMap[:ruby_version]) + else + File.join(ConfigMap[:libdir], ruby_engine, 'gems', + ConfigMap[:ruby_version]) --Apple-Mail-3-820347370 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-3-820347370--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5C9D0969-7B42-4788-AFB9-303772A0043F>