From owner-freebsd-ruby@FreeBSD.ORG Fri Jan 29 05:27:59 2010 Return-Path: Delivered-To: freebsd-ruby@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 157A1106566B for ; Fri, 29 Jan 2010 05:27:59 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id 88D368FC08 for ; Fri, 29 Jan 2010 05:27:58 +0000 (UTC) Received: from [192.168.1.2] (c-71-198-20-159.hsd1.ca.comcast.net [71.198.20.159]) by mx0.deglitch.com (Postfix) with ESMTPSA id A304D8FC4E; Fri, 29 Jan 2010 08:27:55 +0300 (MSK) Message-Id: <5C9D0969-7B42-4788-AFB9-303772A0043F@FreeBSD.org> From: Stanislav Sedov To: Aaron Gifford In-Reply-To: Content-Type: multipart/mixed; boundary=Apple-Mail-3-820347370 Mime-Version: 1.0 (Apple Message framework v936) Date: Thu, 28 Jan 2010 21:27:52 -0800 References: X-Mailer: Apple Mail (2.936) Cc: freebsd-ruby@freebsd.org Subject: Re: Solved: Ruby Gem Require LoadError (8-STABLE, Ruby 1.9.1) X-BeenThere: freebsd-ruby@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Ruby discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jan 2010 05:27:59 -0000 --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--