Installing bcrypt-ruby gem on Windows
Question
I'm trying to install bcrypt-ruby on Windows Vista.
So far, I have been able to install nmake.exe from a MS knowledge base article and cl.exe from installing Visual Studio 2008 Express.
However, I am now encountering this error:
cl -nologo -Wall -I. -IC:/InstantRails/ruby/lib/ruby/1.8/i386-mswin32 -I
C:/InstantRails/ruby/lib/ruby/1.8/i386-mswin32 -I. -MD -Zi -O2b2xg- -G6 -c -Tcb crypt.c
cl : Command line warning D9035 : option 'Og-' has been deprecated and will be removed in a future release
cl : Command line warning D9002 : ignoring unknown option '-G6' bcrypt.c
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\stdio.h(381) : warning C4255: '_get_printf_count_output' : no function prototype given: converting '()' to '(void)'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\stdlib.h(215) : warning C4255: '_get_purecall_handler' : no function prototype given: converting '()' to '(void)'
c:\instantrails\ruby\lib\ruby\gems\1.8\gems\bcrypt-ruby-2.1.2\ext\mri\blf.h(37): fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : return code '0x2' Stop.
I've already executed VCVARS32.bat which presumably sets up the environment. I am suspecting that the warnings and errors are due to installing newer version of Visual Studio.
Has anyone done this successfully? I do not have a copy of Visual Studio 6.0.
Solution
The better, easiest way is to install the development kit:
- Download
devkit-<version>.7z
from here; - unpack it in the Ruby directory (for instance,
C:\Ruby
, so that you'll haveC:\Ruby\devkit
; - from command line, type:
gem install bcrypt-ruby
.
OTHER TIPS
To be able to build a gem extension for One-Click Installer (OCI) you need VC6. Mxing and matching different versions of newer Visual Studio will fail or will generate unknown errors during runtime.
I would recommend avoid all these hassles and proceed with the successor of One-Click, which is called RubyInstaller.
- Download and install either 1.8.6 or 1.9.1 RC1 packages, announced at RubyForge
- Download the Development Kit, and unpack it on your Ruby installation
- Follow
INSTALL.txt
instructions to adjust the DevKit to the location you extracted it - Proceed with
gem install bcrypt-ruby
, will work out of the box
For more details about using other gems or Rails with this newer version, please see the tutorials section in our Wiki.
Hope this helps.
Try below command
gem install bcrypt-ruby --platform=mswin32
For me, the following worked
gem uni bcrypt-ruby
gem i bcrypt-ruby --platform=ruby
I met the same problem when installing devise in windows.
maybe you could checkout this: http://github.com/oneclick/rubyinstaller/wiki/development-kit
and giorgian is correct, pay attention here:
ruby version: you must install the "ruby installer" version, but not .zip version or other version.
unpack it in the Ruby directory (for instance, C:\Ruby, so that you'll have C:\Ruby\devkit;
If you installed ruby from other setup file (which is not ruby-installer), you MUST remove it ,then install ruby with the ruby installer. don't simply overwrite it.
no need to install VC6, it won't work with other ruby setup version(which is not ruby- installer) . if you installed it just for setup the ruby-gem, I suggest you remove it.
no need to install MinGW , cause dev-kit is based on it.
I spent almost 15 hours to solve this problem. and it's now time to say that "ruby-installer" + "dev kit" is our choise to build the native gem.
On Windows Server 2003 (Ruby 1.8.6), the plain vanilla:
gem install bcrypt-ruby
worked like a charm.
Note that if you want to use it with Rails, you must use:
config.gem 'bcrypt-ruby', :lib => 'bcrypt'
For me, a part of the problem was in the fact that I had Ruby2.0.0 x64 installed (I'm running win8), which seemed to be incompatible with the gcc compiler I was using.
I've removed my ruby installation, and installed ruby 1.9.3 together with Bundler, Rails and some other packages with the use railsInstaller (http://railsinstaller.org/) and I'm now able to install bcrypt-ruby :)