15

I am trying to install hpricot using the command:

>gem install hpricot -v 0.8.2
Building native extensions.  This could take a while...
ERROR:  Error installing hpricot:
    ERROR: Failed to build gem native extension.

C:/Ruby19/bin/ruby.exe extconf.rb checking for stdio.h... * extconf.rb failed * Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/Ruby19/bin/ruby C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:362:in try_do': The complier failed to generate an executable file. (RuntimeError) You have to install development tools first. from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:431:intry_cpp' from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:809:in block in have_header' from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:668:inblock in checking_for' from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:274:in block (2 levels) in postpone' from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:248:inopen' from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:274:in block in postpone' from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:248:inopen' from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:270:in postpone' from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:667:inchecking_for' from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:808:in have_header' from extconf.rb:2:in'

Gem files will remain installed in C:/Ruby19/lib/ruby/gems/1.9.1/gems/hpricot-0.8.2 for inspection. Results logged to C:/Ruby19/lib/ruby/gems/1.9.1/gems/hpricot-0.8.2/ext/fast_xs/gem_make.out

it mentions I need to install "development tools" but I have no idea what that refers to. Any suggestions?

Marcus
  • 265
  • 2
  • 7
  • 5
    Try installing the windows ruby devkit (http://rubyinstaller.org/downloads/). This will give you the MinGW compiler which MIGHT overcome your problem. – deau Nov 11 '09 at 22:44
  • 4
    next step is for you to provide an accepted answer to your own question – glenn jackman Nov 11 '09 at 23:29
  • You need to install ruby-dev. It is a development tools [Visit this link to download to Windows](http://stackoverflow.com/questions/37856087/sudo-apt-get-install-ruby-dev-in-windows) – shivakrishna9 Apr 04 '17 at 18:49

5 Answers5

54

Try:

gem install hpricot --platform=mswin32
freek
  • 541
  • 4
  • 2
  • 2
    Worked great for me, and I was worried I was in for a world of hurt. Now trying to get libxml to work! – Eric Pugh Feb 28 '10 at 18:58
  • 2
    I was having the same problem, and this being the first solution that I tried; worked like a charm! I love stack overflow. Thanks for the great answer freek! However, for my own curiosity, does mswin32 means 32-bit windows? If I have 64 bit 7 pro, should I (next time) type mswin64? Sorry, just curious. –  May 20 '10 at 15:12
6

Install the devkit at rubyinstaller.org/downloads

Marcus
  • 265
  • 2
  • 7
4

Execute below command and it works:

gem install hpricot --platform=mswin32
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
AMIC MING
  • 6,306
  • 6
  • 46
  • 62
2

An additional note that others may find useful, from my recent attempt to install on Windows using the Ruby devkit:

To install the devkit, you extract the bin and devkit directories to your Ruby directory which will place a few files in your Ruby bin and a devkit directory in your Ruby directory. Then, per the instructions, you set the proper location for mingw in the fstab file.

In my case, some gems, namely Hpricot and Ruby-Debug19, would not install on my system even with the devkit installed properly because of an error creating the makefile. I ended up installing the latest version of mingw separately from SourceForge, then changed the fstab file within the "ruby19/devkit/msys/1.0.11/etc" directory to point to the directory where I installed mingw. Both gems then installed correctly.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
dh.
  • 21
  • 1
-3

Execute the following command:

gem install hpricot
Spencer Fry
  • 249
  • 1
  • 2
  • 9