代码之家  ›  专栏  ›  技术社区  ›  Tim Post

在Windows上安装Starling

  •  5
  • Tim Post  · 技术社区  · 16 年前

    我正在尝试在我的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
    

    我需要安装什么来提供 windows.h 页眉?

    4 回复  |  直到 12 年前
        1
  •  6
  •   Community Neeleshkumar S    7 年前

    宝石 somewhat broken 目前在windows上 当时窗户坏了,但现在已经修好了。以下解决方法适用于旧的ruby一键安装程序版本;您应该真正更新到基于mingw的新版本 RubyInstaller 以及 DevKit 解决方法仍然有效,但更能证明未来。

    • 找到问题宝石的版本(在本例中是 事件机 )它有一个win32二进制文件。如果你看着 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 update gems会愚蠢地尝试安装最新版本的eventmachine,正如我们已经知道的,它不会构建在windows上。这将导致gem更新完全停止。见 this question 想知道怎么解决 特别烦恼。

        2
  •  0
  •   user6325    16 年前

    安装似乎在安装eventmachine gem时卡住了。 这里最简单的方法可能是下载并安装eventmachine binary gem for windows here

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

        3
  •  0
  •   Jeff Waltzer    16 年前

    我不知道这是否可行,但有人正在windows下开发一个带有c编译器的单击式ruby安装程序。

    http://github.com/luislavena/rubyinstaller/tree/master

        4
  •  0
  •   Marc    16 年前

    现在所有的东西都安装好了,能在windows下运行吗?我得到一个fork()函数在这台机器上没有实现,因为windows没有fork()进程。