Ruby: problem installing EventMachine under Windows 7

I am trying to install the gem EventMachine on Windows 7 (using Ruby 1.9.2 with RubyInstaller) via bundle, but I get the following error. I also installed DevKit and it is working, but I still can't figure out what the problem is:

Installing eventmachine (0.12.10) with native extensions C:/Ruby192/lib/ruby/site_ruby/1.9
.1/rubygems/installer.rb:551:in `rescue in block in build_extensions': ERROR: Failed to bu
ild gem native extension. (Gem::Installer::ExtensionBuildError)

        C:/Ruby192/bin/ruby.exe extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... no
checking for rb_thread_check_ints()... yes
checking for rb_time_new()... yes
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in -lkernel32... yes
checking for main() in -lrpcrt4... yes
checking for main() in -lgdi32... yes
checking for main() in -lssl... no
creating Makefile

make
C:/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_rubyeventmachine'"  > rubyeventmachine-i386-
mingw32.def
g++ -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1.9.1/ruby/
backward -I/C/Ruby192/include/ruby-1.9.1 -I. -DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_RE
GION -DHAVE_TBR -DHAVE_RB_THREAD_CHECK_INTS -DHAVE_RB_TIME_NEW -DOS_WIN32 -DHAVE_WINDOWS_H
 -DHAVE_WINSOCK_H -DWITHOUT_SSL -DHAVE_MAKE_PAIR    -O3 -g -Wextra -Wno-unused-parameter -
Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-
long   -o binder.o -c binder.cpp
In file included from project.h:137:0,
                 from binder.cpp:20:
binder.h:35:34: warning: type qualifiers ignored on function return type
In file included from project.h:138:0,
                 from binder.cpp:20:
em.h:91:47: warning: type qualifiers ignored on function return type
em.h:92:76: warning: type qualifiers ignored on function return type
em.h:93:56: warning: type qualifiers ignored on function return type
em.h:95:57: warning: type qualifiers ignored on function return type
em.h:96:60: warning: type qualifiers ignored on function return type
em.h:97:58: warning: type qualifiers ignored on function return type
em.h:98:55: warning: type qualifiers ignored on function return type
em.h:99:36: warning: type qualifiers ignored on function return type
em.h:101:47: warning: type qualifiers ignored on function return type
em.h:106:42: warning: type qualifiers ignored on function return type
em.h:123:45: warning: type qualifiers ignored on function return type
em.h:132:36: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
                 from binder.cpp:20:
eventmachine.h:45:61: warning: type qualifiers ignored on function return type
eventmachine.h:46:112: warning: type qualifiers ignored on function return type
eventmachine.h:47:69: warning: type qualifiers ignored on function return type
eventmachine.h:49:73: warning: type qualifiers ignored on function return type
eventmachine.h:62:75: warning: type qualifiers ignored on function return type
eventmachine.h:63:74: warning: type qualifiers ignored on function return type
eventmachine.h:64:77: warning: type qualifiers ignored on function return type
eventmachine.h:65:41: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
                 from binder.cpp:20:
eventmachine.h:99:60: warning: type qualifiers ignored on function return type
eventmachine.h:100:58: warning: type qualifiers ignored on function return type
eventmachine.h:102:60: warning: type qualifiers ignored on function return type
eventmachine.h:105:41: warning: type qualifiers ignored on function return type
g++ -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1.9.1/ruby/
backward -I/C/Ruby192/include/ruby-1.9.1 -I. -DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_RE
GION -DHAVE_TBR -DHAVE_RB_THREAD_CHECK_INTS -DHAVE_RB_TIME_NEW -DOS_WIN32 -DHAVE_WINDOWS_H
 -DHAVE_WINSOCK_H -DWITHOUT_SSL -DHAVE_MAKE_PAIR    -O3 -g -Wextra -Wno-unused-parameter -
Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-
long   -o cmain.o -c cmain.cpp
In file included from project.h:137:0,
                 from cmain.cpp:20:
binder.h:35:34: warning: type qualifiers ignored on function return type
In file included from project.h:138:0,
                 from cmain.cpp:20:
em.h:91:47: warning: type qualifiers ignored on function return type
em.h:92:76: warning: type qualifiers ignored on function return type
em.h:93:56: warning: type qualifiers ignored on function return type
em.h:95:57: warning: type qualifiers ignored on function return type
em.h:96:60: warning: type qualifiers ignored on function return type
em.h:97:58: warning: type qualifiers ignored on function return type
em.h:98:55: warning: type qualifiers ignored on function return type
em.h:99:36: warning: type qualifiers ignored on function return type
em.h:101:47: warning: type qualifiers ignored on function return type
em.h:106:42: warning: type qualifiers ignored on function return type
em.h:123:45: warning: type qualifiers ignored on function return type
em.h:132:36: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
                 from cmain.cpp:20:
eventmachine.h:45:61: warning: type qualifiers ignored on function return type
eventmachine.h:46:112: warning: type qualifiers ignored on function return type
eventmachine.h:47:69: warning: type qualifiers ignored on function return type
eventmachine.h:49:73: warning: type qualifiers ignored on function return type
eventmachine.h:62:75: warning: type qualifiers ignored on function return type
eventmachine.h:63:74: warning: type qualifiers ignored on function return type
eventmachine.h:64:77: warning: type qualifiers ignored on function return type
eventmachine.h:65:41: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
                 from cmain.cpp:20:
eventmachine.h:99:60: warning: type qualifiers ignored on function return type
eventmachine.h:100:58: warning: type qualifiers ignored on function return type
eventmachine.h:102:60: warning: type qualifiers ignored on function return type
eventmachine.h:105:41: warning: type qualifiers ignored on function return type
cmain.cpp:98:71: warning: type qualifiers ignored on function return type
cmain.cpp:109:122: warning: type qualifiers ignored on function return type
cmain.cpp:119:79: warning: type qualifiers ignored on function return type
cmain.cpp:129:83: warning: type qualifiers ignored on function return type
cmain.cpp:260:85: warning: type qualifiers ignored on function return type
cmain.cpp:270:84: warning: type qualifiers ignored on function return type
cmain.cpp:280:88: warning: type qualifiers ignored on function return type
cmain.cpp:290:51: warning: type qualifiers ignored on function return type
cmain.cpp:300:70: warning: type qualifiers ignored on function return type
cmain.cpp:320:55: warning: type qualifiers ignored on function return type
cmain.cpp:546:70: warning: type qualifiers ignored on function return type
cmain.cpp:669:68: warning: type qualifiers ignored on function return type
cmain.cpp: In function 'int evma_send_file_data_to_connection(long unsigned int, const cha
r*)':
cmain.cpp:752:6: error: cannot convert 'stat*' to '_stati64*' for argument '2' to 'int _fs
tati64(int, _stati64*)'
make: *** [cmain.o] Error 1


Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.1
0 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/ext/gem_make.ou
t
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in `block in bu
ild_extensions'
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `each'
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `build_exten
sions'
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:in `install'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/source.rb:101:
in `block in install'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/rubygems_integ
ration.rb:78:in `preserve_paths'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/source.rb:91:i
n `install'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/installer.rb:5
8:in `block (2 levels) in run'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/rubygems_integ
ration.rb:93:in `with_build_args'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/installer.rb:5
7:in `block in run'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12
:in `block in each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12
:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12
:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/installer.rb:4
9:in `run'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/installer.rb:8
:in `install'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/cli.rb:222:in
`install'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/vendor/thor/ta
sk.rb:22:in `run'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/vendor/thor/in
vocation.rb:118:in `invoke_task'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/vendor/thor.rb
:246:in `dispatch'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/vendor/thor/ba
se.rb:389:in `start'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/bin/bundle:13:in `<top (re
quired)>'
        from C:/Ruby192/bin/bundle:19:in `load'
        from C:/Ruby192/bin/bundle:19:in `<main>'

Thanks a lot in advance!


Solution 1:

EventMachine 0.12.10 is known to not work under Ruby 1.9.2 on Windows.

Please try latest 1.x pre-release versions:

gem install eventmachine --pre

If you're using with Thin, latest version of Thin works with it properly.

This has been discussed on RubyInstaller group several times.

Solution 2:

Since I am using thin. In my gemfile I put:

gem "thin", "1.3.1"
gem "eventmachine", "1.0.0.rc.1"

Solution 3:

I changed the gemfile and included eventmachine (1.0.0.beta.2) version in it and now its working file.