Q:

Installing starling on Windows

I am trying to install the starling gem on my Windows machine.  But, whenever I try to install it I get this error:
Building native extensions.  This could take a while...  
ERROR:  Error installing starling:  
        ERROR: Failed to build gem native extension.  

c:/ruby/bin/ruby.exe extconf.rb install starling -- --srcdir= c:\ruby-1.8.7-p72  
checking for windows.h... no  
*** 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  
        --srcdir=.  
        --curdir  
        --ruby=c:/ruby/bin/ruby  

Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/eventmachine-0
.12.2 for inspection.  
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/eventmachine-0.12.2/ext/gem_mak
e.out

What do I need to install to provide the windows.h header?

A:

Gems is somewhat broken on Windows at present was at the time broken on Windows, but it's fixed now. The following workaround applies to the old One-Click Installer version of Ruby; you should really update to the new MinGW-based RubyInstaller and the DevKit to which the workaround still works, but is more future proof.

Locate a version of the problem gem (in this case it's eventmachine) that has a win32 binary. If you look on RubyForge, you'll see that the last eventmachine gem to possess a win32 binary is version 0.12.0
Force that version of event machine to install:
$ gem install eventmachine --version=0.12.0
Successfully installed eventmachine-0.12.0-x86-mswin32
1 gem installed
Installing ri documentation for eventmachine-0.12.0-x86-mswin32...
Installing RDoc documentation for eventmachine-0.12.0-x86-mswin32...
Now install try installing your original gem again:
$ gem install starling
Successfully installed ZenTest-3.10.0
Successfully installed memcache-client-1.5.0
Successfully installed SyslogLogger-1.4.0
Successfully installed starling-0.9.8
4 gems installed
Installing ri documentation for ZenTest-3.10.0...
Installing ri documentation for memcache-client-1.5.0...
Installing ri documentation for SyslogLogger-1.4.0...
Installing ri documentation for starling-0.9.8...
Installing RDoc documentation for ZenTest-3.10.0...
Installing RDoc documentation for memcache-client-1.5.0...
Installing RDoc documentation for SyslogLogger-1.4.0...
Installing RDoc documentation for starling-0.9.8...

Be warned though, if you now run gem update gems will stupidly try and install the latest version of eventmachine which, as we already know, won't build on Windows. This causes gem update to stop completely. See this question to find out how to work around this particular annoyance.

