views:

1159

answers:

4

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.

+1  A: 

Hello,

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.

  1. Download and install either 1.8.6 or 1.9.1 RC1 packages, announced at RubyForge
  2. Download the Development Kit, and unpack it on your Ruby installation
  3. Follow INSTALL.txt instructions to adjust the DevKit to the location you extracted it
  4. 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.

Luis Lavena
@Luis: just found out a better way.
giorgian
@giorgian: please share.
Luis Lavena
+4  A: 

The better, easiest way is to install the development kit:

  1. Download devkit-<version>.7z from here;
  2. unpack it in the Ruby directory (for instance, C:\Ruby, so that you'll have C:\Ruby\devkit;
  3. from command line, type: gem install bcrypt-ruby.
giorgian
My solution was to switch to a Mac =) In a day or so, if this is the 'best' solution (I'm not gonna test it out), I will pick yours as the answer. It sounds like a good solution though.
Jaryl
I can confirm that the gem does compile and install correctly with the DevKit installed: http://pastie.org/866429A bit less of a drastic solution than switching to a Mac. ;)
Charles Roper
But you gotta have Visual C++ 6.0 installed, right? I can't get this to work without VC 6.0! Where do I get this 12 year old compiler...??
Pascal Lindelauf
@pascal no. as I said, install ruby installer, then devkit, then simply type gem install bcrypt-ruby.
giorgian
@giorgian I've tried exactly that, but it doesn't work. The "gem install bcrypt-ruby" command still complains that it cannot find "nmake". And nmake isn't anywhere in the devkit either. I see that @charles' screenshot refers to i386-mingw, so that seems to be the prerequisite then if you cannot use Visual C++ 6.0. Correct?
Pascal Lindelauf
@pascal I don't get it, which version of ruby are you using? (before answering to your comment, few days ago, I tried it on a fresh Win7 machine; just installed ruby-installer and devkit, then typed gem install bcrypt-ruby).
giorgian
FYI, link to devkit has changed: http://rubyinstaller.org/downloads/
aaandre
I know this is an old issue, but I've been having a helluva time with this same thing. I ended up doing exactly as @giorgian said, with the addition of following the steps here: http://github.com/oneclick/rubyinstaller/wiki/development-kit. After that, everything is working for me! (Running windows 7).
mc2thaH
A: 

Try below command

gem install bcrypt-ruby --platform=mswin32

Amit
THe best way I've found was the switch to a Mac. So I can't test if your solution works. If anyone tries this out and comments here, I'll accept this as the answer.
Jaryl
A: 

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:

  1. ruby version: you must install the "ruby installer" version, but not .zip version or other version.

  2. unpack it in the Ruby directory (for instance, C:\Ruby, so that you'll have C:\Ruby\devkit;

  3. 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.

  4. 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.

  5. 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.

Siwei Shen