From owner-freebsd-ruby@FreeBSD.ORG Fri Jan 29 04:50:41 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 5AE44106566B for ; Fri, 29 Jan 2010 04:50:41 +0000 (UTC) (envelope-from astounding@gmail.com) Received: from mail-yw0-f194.google.com (mail-yw0-f194.google.com [209.85.211.194]) by mx1.freebsd.org (Postfix) with ESMTP id 1C29A8FC14 for ; Fri, 29 Jan 2010 04:50:40 +0000 (UTC) Received: by ywh32 with SMTP id 32so778869ywh.14 for ; Thu, 28 Jan 2010 20:50:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=DzS0YOZxbRiKtNPGmZbQ0nDxAUNgqXm1hKSEX20yIYY=; b=w1Qio6FhZ2HK4Jr4zqlRZ5W+tW0VuU77Ap7e3WS21uea2vc5BraOsB0OB0V5IPI7Jr 7k6GkNZY47OcXR0HRe4MX70qQL7Mg7pj7B+JOyHFdcVx9LxyNKEQFSktzTj/NeulVcCP lk0dryn9mRUe2TC02LFD5H6nWXDp0QHgP4+g8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=DB2711SaDeDOCbsE6Y8hZIAQYH0cdxkLUN/fMuFpKyagI6JWDdThpvt+O3FCvYlbMd jGpU4rshAgtPBkGlBLSh2IBbkwhUV0uCD5fZe2XIpiYIaFC0N5S4s/XcaO5Kxg1019Af lv/MwBrV5iPrD50CdcgsYNzcAiCkzN7+eYbkY= MIME-Version: 1.0 Received: by 10.101.193.32 with SMTP id v32mr350623anp.8.1264740640484; Thu, 28 Jan 2010 20:50:40 -0800 (PST) Date: Thu, 28 Jan 2010 21:50:40 -0700 Message-ID: From: Aaron Gifford To: freebsd-ruby@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: 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 04:50:41 -0000 On Thu, Jan 28, 2010 at 7:25 PM, Aaron Gifford wrote= : > =A0I wrote: >> One more interesting thing: >> >> % ruby19 -e 'p Gem.default_dir' >> "/usr/local/lib/ruby19/gems/1.9" >> >> That is NOT right. =A0It should be "/usr/local/lib/ruby/gems/1.9" instea= d. >> >> Where does Gem.default_dir get set, does anyone know? >> >> Aaron out. > > It looks like gem_prelude.rb sets up the gems include path. > > The relevant code section is: > > =A0def self.default_dir > =A0 =A0 =A0 =A0File.join File.dirname(ConfigMap[:sitedir]), 'Gems', > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ConfigMap[:ruby_version] > =A0 =A0 =A0elsif RUBY_VERSION > '1.9' then > =A0 =A0 =A0 =A0File.join(ConfigMap[:libdir], ConfigMap[:ruby_install_name= ], 'gems', > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ConfigMap[:ruby_version]) > =A0 =A0 =A0else > =A0 =A0 =A0 =A0File.join(ConfigMap[:libdir], ruby_engine, 'gems', > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ConfigMap[:ruby_version]) > =A0 =A0 =A0end > =A0 =A0end > > So the Gem.default_dir is being set to: > =A0File.join(ConfigMap[:libdir], ConfigMap[:ruby_install_name], 'gems', > ConfigMap[:ruby_version]) > > (that's the middle "RUBY_VERSION > '1.9'" code chunk) > > So ConfigMap[:ruby_install_name] is "ruby19" in this case, and THAT's > what is screwing this up. > > > > IDEAS: > > Either the FreeBSD Ruby 1.9 port needs to install things in > "/usr/local/lib/ruby19" instead of "/usr/local/lib/ruby/" so the code > will work as-is, or else something's gotta change with > ConfigMap[:ruby_install_name], or else gem_prelude.rb code has to be > changed... > > So... anyone with expertise, where does one go from here? > > Aaron out. 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=3D$@ \ -install_name=3D$(RUBY_INSTALL_NAME) \ -so_name=3D$(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=3D"${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): =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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', =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D This works. Building/installing gems under 1.9.1 (with RUBY_VERSION=3D1.9.1 in /etc/make.conf) did not break (still works), but this time, no LoadErrors during require. AT LAST! user@host:/home/user% irb19 irb(main):001:0> require 'net/ssh' =3D> true irb(main):002:0> And that makes ruby19 -e 'p Gem.default_dir' output "/usr/local/lib/ruby/gems/1.9" like it should. Aaron out.