在Windows上安装starling

Jos*_*ore 5 ruby rubygems starling-server

我正在尝试在我的Windows机器上安装starling gem.但是,每当我尝试安装它时,我都会收到此错误:

Building native extensions.  This could take a while...  
ERROR:  Error installing starling:  
        ERROR: Failed to build gem native extension.  

c:/ruby/bin/ruby.exe extconf.rb install starling -- --srcdir= c:\ruby-1.8.7-p72  
checking for windows.h... no  
*** extconf.rb failed ***  
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:  
        --with-opt-dir  
        --without-opt-dir  
        --with-opt-include  
        --without-opt-include=${opt-dir}/include  
        --with-opt-lib  
        --without-opt-lib=${opt-dir}/lib  
        --with-make-prog  
        --srcdir=.  
        --curdir  
        --ruby=c:/ruby/bin/ruby  

Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/eventmachine-0
.12.2 for inspection.  
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/eventmachine-0.12.2/ext/gem_mak
e.out
Run Code Online (Sandbox Code Playgroud)

我需要安装什么来提供windows.h标题?

Cha*_*per 6

目前Windows上的 Gems 某种程度上被破坏了,但是现在已经修复了.以下解决方法适用于旧的One-Click Installer版本的Ruby; 你应该真正更新到新的基于MinGW的RubyInstaller和解决方法仍然适用的DevKit,但更具有未来性.

  • 找到具有win32二进制文件的问题gem的版本(在本例中为eventmachine).如果你看看RubyForge,你会发现拥有win32二进制文件的最后一个eventmachine gem是版本0.12.0
  • 强制安装该版本的事件机器:

    $ gem install eventmachine --version=0.12.0
    Successfully installed eventmachine-0.12.0-x86-mswin32
    1 gem installed
    Installing ri documentation for eventmachine-0.12.0-x86-mswin32...
    Installing RDoc documentation for eventmachine-0.12.0-x86-mswin32...

  • 现在安装尝试再次安装原始gem:

    $ gem install starling
    Successfully installed ZenTest-3.10.0
    Successfully installed memcache-client-1.5.0
    Successfully installed SyslogLogger-1.4.0
    Successfully installed starling-0.9.8
    4 gems installed
    Installing ri documentation for ZenTest-3.10.0...
    Installing ri documentation for memcache-client-1.5.0...
    Installing ri documentation for SyslogLogger-1.4.0...
    Installing ri documentation for starling-0.9.8...
    Installing RDoc documentation for ZenTest-3.10.0...
    Installing RDoc documentation for memcache-client-1.5.0...
    Installing RDoc documentation for SyslogLogger-1.4.0...
    Installing RDoc documentation for starling-0.9.8...

但请注意,如果您现在运行gem updategems将愚蠢地尝试安装最新版本的eventmachine,正如我们已经知道的那样,它不会在Windows上构建.这会导致gem更新完全停止.看到这个问题,找出如何解决这个特殊的烦恼.


小智 0

安装似乎停留在安装 eventmachine gem 上。这里最简单的方法可能是在此处下载并安装适用于 Windows 的 eventmachine 二进制 gem

否则你将需要一个编译器。(我假设你没有)