Most gems are very easy to install however they have typically been created for a Unix or Linux environment such as CentOS, RedHat, or OS X. This can cause all sorts of issues with libraries, compilers, etc. because less time has been spent making sure that these gems install on all versions of Windows because of all the differences. It is much easier to make sure that the gems install across all UNIX/Linux versions instead of the Windows versions.
When attempting to install this gem on a Windows server or a regular PC based desktop you will run across an error. The error will spit out a bunch of data including install switches along with some other error information such as the below.
Error Output Installing eventmachine gem on Windows XP:
- C:\>gem install eventmachine
- Building native extensions. This could take a while...
- ERROR: Error installing eventmachine:
- ERROR: Failed to build gem native extension.
- c:/ruby/bin/ruby.exe extconf.rb install eventmachine
- 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_make.out
The error also lets you know to review the mkmf.log for more details. I included an example of what the output of the error installing the gem on Windows might output to the mkmf.log file.
Contents of mkmf.log After Receiving Above Errors:
- have_header: checking for windows.h... -------------------- no
- "cl -nologo -E -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I. -MD -Zi -O2b2xg- -G6 conftest.c -P"
- checked program was:
- /* begin */
- 1: #include
- /* end */
- --------------------
Resolution to this error is easy. Instead of installing this gem, you should actually install the win32 version of this gem which has been created specifically for Windows. The version number of the win32 based gem appears to be much older than that the initial gem, but that is because the win32 version doesn’t have as many releases since it was created long after the original gem was.
Output of Successful Win-32 Version of gem on Windows XP:
- C:\>gem install eventmachine-win32
- Successfully installed eventmachine-win32-0.7.2
- 1 gem installed
- Installing ri documentation for eventmachine-win32-0.7.2...
- Installing RDoc documentation for eventmachine-win32-0.7.2...
Click here to checkout the latest updates for the win32 version of this gem on Github or click here to read more Question Defense articles related to eventmachine.
very helpful…enough said
Hello yonni,
Great. We appreciate when users take the time to leave feedback!
Thanks.
alex
whoa, this is EXACTLY what i’m looking for. thanks so much!
Hello wari,
No problem at all. Thanks for posting feedback.
Thanks.
alex
Thank you very much alex! You saved my morning… :)
Hello dias,
No problem. Glad you found the article about the ruby gem eventmachine helpful.
Thanks.
alex
Hurray, the information in your post is exactly what I needed, thanks a lot.
Hello Jety,
No problem. Thanks for taking the time to leave feedback.
Thanks.
alex