在Windows上安装bcrypt-ruby gem

时间:2009-11-03 10:31:59

标签: windows ruby gem bcrypt

我正在尝试在Windows Vista上安装bcrypt-ruby

到目前为止,我已经能够从安装Visual Studio 2008 Express的MS知识库文章和cl.exe安装nmake.exe。

但是,我现在遇到这个错误:

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.

我已经执行了VCVARS32.bat,这可能会设置环境。我怀疑警告和错误是由于安装了较新版本的Visual Studio。

有没有人成功完成这项工作?我没有Visual Studio 6.0的副本。

7 个答案:

答案 0 :(得分:9)

更好,最简单的方法是安装development kit

  1. here下载devkit-<version>.7z;
  2. 将其解压缩到Ruby目录中(例如,C:\Ruby,以便您拥有C:\Ruby\devkit;
  3. 从命令行输入:gem install bcrypt-ruby

答案 1 :(得分:1)

为了能够为One-Click安装程序(OCI)构建gem扩展,您需要VC6。 Mxing和匹配不同版本的较新Visual Studio将失败或将在运行时生成未知错误。

我建议避免所有这些麻烦,继续使用One-Click的后续版本,称为RubyInstaller。

  1. 下载并安装1.8.6或1.9.1 RC1程序包announced at RubyForge
  2. 下载开发工具包,并在Ruby安装中解压缩
  3. 按照INSTALL.txt说明将DevKit调整为您提取的位置
  4. 继续gem install bcrypt-ruby,将开箱即用
  5. 有关在此版本中使用其他gem或Rails的详细信息,请参阅Wiki中的tutorials部分。

    希望这有帮助。

答案 2 :(得分:1)

尝试以下命令

gem install bcrypt-ruby --platform = mswin32

答案 3 :(得分:1)

对我来说,以下工作

gem uni bcrypt-ruby
gem i bcrypt-ruby --platform=ruby

答案 4 :(得分:0)

在Windows中安装设备时遇到了同样的问题。

也许你可以查看这个: http://github.com/oneclick/rubyinstaller/wiki/development-kit

和giorgian是对的,请注意:

  1. ruby​​版本:您必须安装“ruby installer”版本,但不能安装.zip版本或其他版本。

  2. 将它解压缩到Ruby目录中(例如,C:\ Ruby,这样你就可以拥有C:\ Ruby \ devkit;

  3. 如果您从其他安装文件(不是ruby-installer)安装了ruby,则必须将其删除,然后使用ruby安装程序安装ruby。不要简单地覆盖它。

  4. 无需安装VC6,它不能与其他ruby安装版本(不是ruby-installer)一起使用。如果你安装它只是为了设置ruby-gem,我建议你删除它。

  5. 无需安装MinGW,因为dev-kit是基于它的。

  6. 我花了将近15个小时来解决这个问题。现在是时候说“ruby-installer”+“开发工具包”是我们选择构建原生宝石。

答案 5 :(得分:0)

在Windows Server 2003(Ruby 1.8.6)上,普通的vanilla:

gem install bcrypt-ruby

像魅力一样工作 请注意,如果要将其与Rails一起使用,则必须使用:

config.gem 'bcrypt-ruby', :lib => 'bcrypt'

答案 6 :(得分:0)

对我来说,问题的一部分是因为我安装了Ruby2.0.0 x64(我正在运行win8),这似乎与我使用的gcc编译器不兼容。

我删除了我的ruby安装,并使用railsInstaller(http://railsinstaller.org/)将Bundy,Rails和其他一些软件包与ruby 1.9.3一起安装,我现在可以安装bcrypt-ruby了:)

相关问题