Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 417319

Summary: dev-ruby/racc-1.4.6-r1 fails to install : -e:1: uninitialized constant Gem (NameError)
Product: Gentoo Linux Reporter: Andreas K. Hüttel <dilfridge>
Component: Current packagesAssignee: Gentoo Ruby Team <ruby>
Status: RESOLVED NEEDINFO    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info output

Description Andreas K. Hüttel archtester gentoo-dev 2012-05-23 22:27:46 UTC
Created attachment 312887 [details]
emerge --info output

* Package:    dev-ruby/racc-1.4.6-r1
 * Repository: gentoo
 * Maintainer: ruby@gentoo.org
 * USE:        amd64 consolekit elibc_glibc kernel_linux multilib policykit ruby_targets_ruby18 ruby_targets_ruby19 userland_GNU
 * FEATURES:   compressdebug preserve-libs sandbox splitdebug userpriv usersandbox
>>> Unpacking source...
 * Running unpack phase for all ...
 * Unpacking .gem file... ...
 [ ok ]
 * Uncompressing metadata ...
 [ ok ]
 * Unpacking data.tar.gz ...
 [ ok ]
>>> Source unpacked in /var/tmp/portage/dev-ruby/racc-1.4.6-r1/work
>>> Preparing source in /var/tmp/portage/dev-ruby/racc-1.4.6-r1/work ...
 * Running prepare phase for all ...
 * Applying racc-1.4.6-test-unit.patch ...
 [ ok ]
 * Running source copy phase for ruby18 ...
 * Running source copy phase for ruby19 ...
 * Running prepare phase for ruby18 ...
 * Running prepare phase for ruby19 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-ruby/racc-1.4.6-r1/work ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-ruby/racc-1.4.6-r1/work ...
 * Running compile phase for ruby18 ...
(in /var/tmp/portage/dev-ruby/racc-1.4.6-r1/work/ruby18/racc-1.4.6)
/usr/bin/ruby18 extconf.rb
creating Makefile
make
x86_64-pc-linux-gnu-gcc -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I/usr/lib64/ruby/1.8/x86_64-linux -I.   -fPIC -march=native -O2 -pipe -ggdb -fno-strict-aliasing  -fPIC   -c cparse.c
x86_64-pc-linux-gnu-gcc -shared -o cparse.so cparse.o -L. -L/usr/lib64 -Wl,-R/usr/lib64 -L. -Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -rdynamic -Wl,-export-dynamic -Wl,--no-undefined    -Wl,-R -Wl,/usr/lib64 -L/usr/lib64 -lruby18  -lpthread -lrt -ldl -lcrypt -lm   -lc
 * Running compile phase for ruby19 ...
/usr/lib64/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake/alt_system.rb:32: Use RbConfig instead of obsolete and deprecated Config.
(in /var/tmp/portage/dev-ruby/racc-1.4.6-r1/work/ruby19/racc-1.4.6)
/usr/bin/ruby19 extconf.rb
creating Makefile
make
compiling cparse.c
linking shared-object racc/cparse/cparse.so
 * Running compile phase for all ...
>>> Source compiled.
>>> Test phase [not enabled]: dev-ruby/racc-1.4.6-r1

>>> Install racc-1.4.6-r1 into /var/tmp/portage/dev-ruby/racc-1.4.6-r1/image/ category dev-ruby
 * Running install phase for ruby18 ...
-e:1: uninitialized constant Gem (NameError)
 * ERROR: dev-ruby/racc-1.4.6-r1 failed (install phase):
 *   Unable to generate gemspec file.
 * 
 * Call stack:
 *     ebuild.sh, line   85:  Called src_install
 *   environment, line 4247:  Called ruby-ng_src_install
 *   environment, line 3948:  Called _ruby_each_implementation 'each_ruby_install'
 *   environment, line  413:  Called _ruby_invoke_environment 'ruby18' 'each_ruby_install'
 *   environment, line  465:  Called each_ruby_install
 *   environment, line  764:  Called each_fakegem_install
 *   environment, line  736:  Called ruby_fakegem_install_gemspec
 *   environment, line 4105:  Called die
 * The specific snippet of code:
 *       fi ) || die "Unable to generate gemspec file.";
 * 
 * If you need support, post the output of `emerge --info '=dev-ruby/racc-1.4.6-r1'`,
 * the complete build log and the output of `emerge -pqv '=dev-ruby/racc-1.4.6-r1'`.
!!! When you file a bug report, please include the following information:
GENTOO_VM=  CLASSPATH="" JAVA_HOME="/etc/java-config-2/current-system-vm"
JAVACFLAGS="" COMPILER=""
and of course, the output of emerge --info
 * The complete build log is located at '/var/log/portage/build/dev-ruby/racc-1.4.6-r1:20120523-214233.log.gz'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/dev-ruby/racc-1.4.6-r1/temp/build.log.gz'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-ruby/racc-1.4.6-r1/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-ruby/racc-1.4.6-r1/work/ruby18/racc-1.4.6'
 * S: '/var/tmp/portage/dev-ruby/racc-1.4.6-r1/work/ruby18/racc-1.4.6'
Comment 1 Hans de Graaff gentoo-dev Security 2012-05-25 11:02:39 UTC
I can't reproduce this. Which version of rubygems do you have installed? Is RUBYOPT environment variable set up properly?
Comment 2 Andreas K. Hüttel archtester gentoo-dev 2012-06-02 21:10:51 UTC
(In reply to comment #1)
> I can't reproduce this. Which version of rubygems do you have installed? 

dev-ruby/rubygems-1.8.24

> Is
> RUBYOPT environment variable set up properly?

pinacolada ~ # set|grep RUBY
RUBYOPT=-rauto_gem

Where is it documented?
Comment 3 Hans de Graaff gentoo-dev Security 2012-06-10 07:19:23 UTC
(In reply to comment #2)

> pinacolada ~ # set|grep RUBY
> RUBYOPT=-rauto_gem
> 
> Where is it documented?

I'm not sure it is documented. It is set as part of the environment by dev-lang/ruby to ensure that rubygems are loaded automatically. It's something that commonly goes wrong when people chroot or something similar.

Can you try this (which is the command failing in the eclass). That should fail due to the bogus filename, but the failure you are reporting happens earlier anyway.

ruby -r yaml -e "puts Gem::Specification.from_yaml(File::open('bogus').read).to_ruby"
Comment 4 Andreas K. Hüttel archtester gentoo-dev 2012-06-10 15:26:30 UTC
pinacolada ~ # ruby -r yaml -e "puts Gem::Specification.from_yaml(File::open('bogus').read).to_ruby"
-e:1:in `initialize': No such file or directory - bogus (Errno::ENOENT)
        from -e:1:in `open'
        from -e:1

Same as normal user...
Comment 5 Hans de Graaff gentoo-dev Security 2012-06-11 17:09:50 UTC
(In reply to comment #4)
> pinacolada ~ # ruby -r yaml -e "puts
> Gem::Specification.from_yaml(File::open('bogus').read).to_ruby"
> -e:1:in `initialize': No such file or directory - bogus (Errno::ENOENT)

So that works as expected. I'm really not sure why this won't work from within the ebuild then.
Comment 6 Andreas K. Hüttel archtester gentoo-dev 2012-06-16 21:40:28 UTC
Interestingly, in the ebuild environment file, RUBYOPT is empty...

... and after setting in make.conf
RUBYOPT=-rauto_gem

the build worked fine...   ?:|
Comment 7 Hans de Graaff gentoo-dev Security 2012-06-17 06:56:48 UTC
(In reply to comment #6)
> Interestingly, in the ebuild environment file, RUBYOPT is empty...
> 
> ... and after setting in make.conf
> RUBYOPT=-rauto_gem
> 
> the build worked fine...   ?:|

Perhaps this was a new install and the environment wasn't re-read after installing dev-lang/ruby (and thus the RUBYOPT variable wasn't set yet)?
Comment 8 Andreas K. Hüttel archtester gentoo-dev 2012-06-17 09:39:02 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Interestingly, in the ebuild environment file, RUBYOPT is empty...
> > 
> > ... and after setting in make.conf
> > RUBYOPT=-rauto_gem
> > 
> > the build worked fine...   ?:|
> 
> Perhaps this was a new install and the environment wasn't re-read after
> installing dev-lang/ruby (and thus the RUBYOPT variable wasn't set yet)?

Definitely not, this is my main dev system, continuously updated for a year at least...

For me the problem is solved now, but I'm just not sure, is RUBYOPT supposed to be set in make.conf ?
Comment 9 Hans de Graaff gentoo-dev Security 2012-06-17 09:45:33 UTC
(In reply to comment #8)

> For me the problem is solved now, but I'm just not sure, is RUBYOPT supposed
> to be set in make.conf ?

It is set in /etc/env.d/10rubygems, which is installed by dev-ruby/rubygems.
Comment 10 Hans de Graaff gentoo-dev Security 2015-07-05 18:26:19 UTC
Closing this old bug since it is not clear if there was something that we could fix.