【问题标题】:Getting error while trying to install watir尝试安装 Watir 时出错
【发布时间】:2013-11-13 21:37:32
【问题描述】:

我在安装 Watir 时遇到问题。我猜我缺少一些 C 库。 这是我所做的:

  • 已安装 Ruby 安装程序
  • 已安装开发包
  • gem 更新 --system
  • gem install watir --platform x86-mingw32

这是我的输出:

C:\>gem install watir --platform x86-mingw32
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing watir:
    ERROR: Failed to build gem native extension.

C:/Ruby200/bin/ruby.exe extconf.rb
checking for ffi.h... *** 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:/Ruby200/bin/ruby
    --with-ffi_c-dir
    --without-ffi_c-dir
    --with-ffi_c-include
    --without-ffi_c-include=${ffi_c-dir}/include
    --with-ffi_c-lib
    --without-ffi_c-lib=${ffi_c-dir}/
    --with-libffi-config
    --without-libffi-config
    --with-pkg-config
    --without-pkg-config
C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:430:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first.
    from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:561:in `try_cpp'
    from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:1040:in `block in have_header'
    from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:891:in `block in checking_for'
    from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:336:in `block (2 levels) in postpone'
    from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:306:in `open'
    from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:336:in `block in postpone'
    from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:306:in `open'
    from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:332:in `postpone'
    from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:890:in `checking_for'
    from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:1039:in `have_header'
    from extconf.rb:16:in `<main>'


Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/ffi-1.9.3 for inspection. Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/ffi-1.9.3/ext/ffi_c/gem_make.out

【问题讨论】:

  • 你正在使用什么操作系统?
  • 你用的是什么 Ruby? 32位还是64位?您是否为您的 Ruby 安装了正确版本的 Devkit?一种方法是删除 Devkit 目录并下载正确的版本并使用--force 标志再次安装。

标签: ruby rubygems watir


【解决方案1】:

您为 MINGW 平台的 FFI 安装头文件。如果您为 CYGWIN 使用 MINGW,则应运行 CYGWIN 安装程序并安装 libffi-devel/libffi-dev 包。否则,您应该为 MINGW 安装外部开发包,例如 this,以支持 ffi 的开发头文件。

此外,请参阅此处了解如何在 mingw here 上使用 FFI

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-15
    • 2017-10-11
    • 2015-01-17
    • 2018-03-05
    • 2015-12-18
    • 2017-11-18
    • 1970-01-01
    相关资源
    最近更新 更多