3
votes

I am trying to install a ruby gem. I am getting this error.

C:\>gem install racc
Building native extensions.  This could take a while...
ERROR:  Error installing racc:
        ERROR: Failed to build gem native extension.

c:/ruby/bin/ruby.exe extconf.rb install racc
extconf.rb:3:in ``': No such file or directory - uname -p (Errno::ENOENT)
        from extconf.rb:3


Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/racc-1.4.6 for inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/racc-1.4.6/ext/racc/cparse/gem_make.out

I have searched this site, but found nothing about it. I have googled too, and found only that updating ruby gems should solve the problem, but it did not.

I have ruby gems 1.2.0 and ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32], Windows 2003.

2
Is "uname -p" a valid command on your system? - Inshallah
No. Looks like that is unix command. en.wikipedia.org/wiki/Uname - Željko Filipin
I was thinking about how "uname -p" shows up in the error message and that perhaps it not being present on your system could have caused the error. - Inshallah
I understood your comment. :) It gave me an idea to install msys and cygwin to see if it will work then, but no luck. - Željko Filipin

2 Answers

4
votes

This may not be directly related to this post but it helped me and i hope may help others who have had the "Failed to build gem native extension." error when installing gems on Windows.

The guys over at rubyinstaller.org provide a DevKit (http://rubyinstaller.org/download.html) containing GCC, Make and Sh for use when installing Gems. I followed the instructions for installing (http://wiki.github.com/oneclick/rubyinstaller/development-kit) and hey presto... gems that previously wouldn't install now install with no errors.

I've tested installing the RACC gem and had no problems (although i have no previous experience with this gem; maybe it has been fixed since.) I've also tested with RCOV (which i've never been able to get working correctly) and have managed to install it with no errors!

Hope this helps someone out there ;)

2
votes

The offending line in the extconf.rb file in the racc gem is this:

ENV["ARCHFLAGS"] = "-arch #{`uname -p` =~ /powerpc/ ? 'ppc' : 'i386'}"

Since you are not using a PowerPC (unless your setup is exceptionally unusual :) ), you can replace this line with:

ENV["ARCHFLAGS"] = "-arch i386"

I don't know if it will compile successfully now, but at least you'll be past this error.