views:

1572

answers:

5

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: 

The install seems to be stuck on installing the eventmachine gem. The easiest approach here may be to download and install the eventmachine binary gem for windows here

Otherwise you will need a compiler. (which I assume you don't have)

A: 

I don't know if this will work but someone is working on a one click installer of Ruby under Windows that comes with a C compiler.

See http://github.com/luislavena/rubyinstaller/tree/master

Jeff Waltzer
+5  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.

Charles Roper
A: 

Aweosme. Worked! Thanks!

A: 

Now that everything is installed, is it possible to get it working under windows? I'm getting a fork() function unimplemented on this machine, because, Windows doesn't have a fork() process.