I am a heretic. I develop Rails apps on Windows. I own a Macbook, but I usually boot it into Windows. Justin thinks I should just should just move to developing on a Mac. I keep holding out. But periodically I try to install a gem that needs to compile native extensions for Windows, and it fails. This just makes me mad. My latest encounter was with the bcrypt gem. I did some googling and finally found a solution:
- Dug up my old copy of Visual Studio 6 CDs and installed the command line utilities. Apparently, not just any version will do; you have to be in sync with the version used to compile ruby.
- Added VS6’s bin directories to my Windows path. Default install locations are:
C:\Program Files\Microsoft Visual Studio\VC98\Bin;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;Alternatively, you can get a command prompt in C:\Program Files\Microsoft Visual Studio\VC98\Bin and run VCVARS32.BAT to add those directories to your path.
- Added some typedefs and a function to C:\Program Files\Microsoft Visual Studio\VC98\Include\SYS\TYPES.H that are not available on Windows:
#ifndef _UINT_T_DEFINED typedef unsigned char u_int8_t; typedef unsigned short u_int16_t; typedef unsigned int u_int32_t; typedef unsigned __int64 u_int64_t; #define _UINT_T_DEFINED #endif
#ifndef snprintf #define snprintf _snprintf #endif
Now I can do:
gem install bcrypt-ruby
I get the “Building native extensions. This could take a while…” message and it works!
I’m happy once again. I’m satisfied. And I didn’t even have to change religions.
Posted on May 11th, 2009 by joel
Filed under: rails, web development | 1 Comment »











Shankar’s book that I used in my quantum mechanics class at the University of Utah. I also smiled to see him list his