在Windows上可能与libgit2一起使用Rugged gem安装问题

时间:2015-07-06 00:41:23

标签: ruby windows gem

我正在使用Windows而我的Gemfile有这一行:

gem 'rugged'

当我运行bundle install时,它会给我这个错误:

Installing rugged 0.21.0 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    C:/Ruby21/bin/ruby.exe extconf.rb --use-system-libraries
    checking for cmake... no 
    ERROR: CMake is required to build Rugged.

*** 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
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby21/bin/ruby

extconf failed, exit code 1

Gem files will remain installed in
C:/Ruby21/lib/ruby/gems/2.1.0/gems/rugged-0.21.0 for inspection.
Results logged to C:/Ruby21/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/rugged-0.21.0/gem_make.out

An error occurred while installing rugged(0.21.0), and Bundler cannot continue.

Make sure that `gem install rugged -v '0.21.0'` succeeds before
bundling.

我猜它与libgit2有关,但我不确定。

1 个答案:

答案 0 :(得分:3)

这实际上是一个令我感到惊讶的问题,并没有被问到更多。但rugged需要CMake& pkg-config以便正确编译。

因为我们可以,我们会将它们提取到 DevKit 本身。

首先让我们抓一个副本:

CMake非常直截了当,here's the download link pkg-config有点复杂,它有一些依赖性等等。但是,有nice package bundled with the dependencies

然后将正确的文件解压缩 DevKit

拥有它们后,您需要打开每个存档(requires 7-zip)并打开存档中的顶级文件夹。
从那里,您需要将存档中的binshare目录提取到 DevKit 根目录中。
它应该将目录合并到现有目录中,不应覆盖或删除任何内容。

再次尝试安装,它应正常工作,并且您不会弄脏PATH更多东西。