views:

49

answers:

3

A couple of Rails applications I downloaded have dependencies on bson_ext which appears to be a native code library. When I run rake gems:install for the app I get the following error message:

ERROR:  Error installing bson_ext:
        ERROR: Failed to build gem native extension.

d:/Ruby187/bin/ruby.exe extconf.rb
checking for asprintf()... no
checking for ruby/st.h... no
checking for st.h... no
checking for ruby/regex.h... no
checking for regex.h... no
checking for ruby/encoding.h... no
creating Makefile

make
'make' is not recognized as an internal or external command,
operable program or batch file.


Gem files will remain installed in d:/Ruby187/lib/ruby/gems/1.8/gems/bson_ext-1.0.1 for inspection.
Results logged to d:/Ruby187/lib/ruby/gems/1.8/gems/bson_ext-1.0.1/ext/cbson/gem_make.out

My questions are:

  1. Will my rails application fail because of this, I think I know the answer to this?

  2. If I need to build this gem can I do it on windows?

  3. If it can be built on Windows what toolchain do I need? GCC?

  4. Should I just abandon Windows for Rails development and use my Mac or a Linux VM instead?

+1  A: 
  1. Yes, this application won't start if one of the gems it depends on isn't installed. A gem that includes a native extension can't be installed unless the extension is compiled properly.
  2. Well, windows isn't the most supported OS in the ruby world :) but I think chances are you'll be able to.
  3. You'll need a C compiler and other tools like make. In most cases installing Visual Studio or Visual C++ is enough.
  4. This is highly recommended for any kind of more-or-less serious development. You are likely to encounter some nasty issues on windows. I myself have become as happy a developer as one could be since I've switched to mac :)
neutrino
+2  A: 

Try using RubyInstaller and the optional DevKit. With the DevKit installed you should be able to build (compile) most native extensions on windows.

banister
This looks promising. I managed to get bson_ext built but there's another native library that the GCC compiler is choking on for some reason. Never a dull moment eh? cheers for the devkit tip :)
Kev
@Kev, if you have any problems compiling extensions post your issue on the RubyInstaller mailing list. It's a very responsive forum and they are very fast giving solutions.
banister
+1  A: 

Have you tried running Ruby from Cygwin?

jpartogi