What to do about failed native extension builds in gem on Windows?
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:
Will my rails application fail because of this, I think I know the answer to this?
If I need to build this gem can I do it on windows?
If it can be built on Windows what toolchain do I need? GCC?
Should I just abandon Windows for Rails development and use my Mac or a Linux VM instead?
Try using RubyInstaller and the optional DevKit. With the DevKit installed you should be able to build (compile) most native extensions on windows.
- 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.
- Well, windows isn't the most supported OS in the ruby world :) but I think chances are you'll be able to.
- You'll need a C compiler and other tools like make. In most cases installing Visual Studio or Visual C++ is enough.
- 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 :)
Have you tried running Ruby from Cygwin?
精彩评论