Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error while installing ruby gem

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.

like image 987
Željko Filipin Avatar asked Aug 01 '26 20:08

Željko Filipin


2 Answers

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 ;)

like image 133
Jim McKerchar Avatar answered Aug 03 '26 13:08

Jim McKerchar


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.

like image 42
Daniel Lucraft Avatar answered Aug 03 '26 12:08

Daniel Lucraft