无法在windows7中安装curb gem

时间:2013-08-07 10:19:45

标签: ruby-on-rails-4 curb

curb gem无法安装。 我正在使用以下配置: -

  • Windows 7

  • Ruby 2

  • Rails 4

  • gem“bundler 1.3.5”

  

C:\ RorProjects> gem install curb

构建原生扩展。这可能需要一段时间...... 错误:安装路边错误: 错误:无法构建gem原生扩展。

    C:\Users\abc>gem install curb
    Temporarily enhancing PATH to include DevKit...
    Building native extensions.  This could take a while.....
    ERROR:  Error installing curb:
            ERROR: Failed to build gem native extension.

    C:/Rubyinstaller200/bin/ruby.exe extconf.rb
checking for curl-config... no
checking for main() in -lcurl... 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
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Rubyinstaller200/bin/ruby
        --with-curl-dir
        --without-curl-dir
        --with-curl-include
        --without-curl-include=${curl-dir}/include
        --with-curl-lib
        --without-curl-lib=${curl-dir}/
        --with-curllib
        --without-curllib
extconf.rb:18:in `<main>':   Can't find libcurl or curl/curl.h (RuntimeError)

  Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
  options to extconf.


Gem files will remain installed in C:/Rubyinstaller200/lib/ruby/gems/2.0.0/gems/
curb-0.8.4 for inspection.
Results logged to C:/Rubyinstaller200/lib/ruby/gems/2.0.0/gems/curb-0.8.4/ext/ge
m_make.out

2 个答案:

答案 0 :(得分:1)

尝试安装mingw并在其中运行命令,我还没有在Windows上工作一段时间,但它曾用于修复我的gem安装问题:

http://www.mingw.org/

答案 1 :(得分:0)

您必须指定头文件和静态库的路径才能构建扩展。首先确保安装了ruby devkit。然后download x86包(后缀'devel',它是包含所有内容的那个),在某处提取并尝试gem install curb -- --with-curl-lib=c:/path/to/curl/lib --with-curl-include=c:/path/to/curl/include

如果这个不起作用(对我来说,当我尝试使用libcurl 7.32.0和ruby 2.0安装curb时没有),你可以尝试下载x86 libcurl包here,按照说明操作在第一篇文章中提取它,设置环境然后运行gem install curb -- -with-opt-dir=c:/path/to/libcurl。这让我在这篇文章的时候遏制了0.8.5。