gpt4 book ai didi

ruby - 无法在 Windows 中使用 Cygwin 安装 Mechanize(错误 : Failed to build gem native extension.)

转载 作者:行者123 更新时间:2023-12-04 16:20:28 27 4
gpt4 key购买 nike

我一直没有成功安装 Mechanize
我当前的 ruby​​ 版本 2.0.0

这就是我得到的错误

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

/usr/bin/ruby.exe extconf.rb
checking for main() in -lstdc++... *** 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=/usr/bin/ruby
--with-stdc++lib
--without-stdc++lib
/usr/share/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/ruby/2.0.0/mkmf.rb:519:in `try_link0'
from /usr/share/ruby/2.0.0/mkmf.rb:534:in `try_link'
from /usr/share/ruby/2.0.0/mkmf.rb:720:in `try_func'
from /usr/share/ruby/2.0.0/mkmf.rb:950:in `block in have_library'
from /usr/share/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from /usr/share/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /usr/share/ruby/2.0.0/mkmf.rb:310:in `open'
from /usr/share/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /usr/share/ruby/2.0.0/mkmf.rb:310:in `open'
from /usr/share/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /usr/share/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from /usr/share/ruby/2.0.0/mkmf.rb:945:in `have_library'
from extconf.rb:2:in `<main>'


Gem files will remain installed in /home/Dennis/.gem/ruby/gems/unf_ext-0.0.6 for inspection.
Results logged to /home/Dennis/.gem/ruby/gems/unf_ext-0.0.6/ext/unf_ext/gem_make.out

我试过这个 solution但不适合我。我仍然收到这个类似的错误。

我也安装了 nokogiri。我想知道这里有什么问题...

最佳答案

要构建 native 扩展,您需要安装开发工具包。

转至 Ruby Installer download page ,下载开发套件 根据您的 Ruby 和系统版本,将套件安装到适当的目录,然后重新安装 gem。

关于ruby - 无法在 Windows 中使用 Cygwin 安装 Mechanize(错误 : Failed to build gem native extension.),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29553893/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com