gpt4 book ai didi

ruby - 在 AWS Linux 上安装 Ruby gem Mechanize 时出错

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:45:57 26 4
gpt4 key购买 nike

更新:我运行了 sudo yum install ruby​​-devel,然后运行了 sudo gem install mechanize,这给了我这个错误:

ERROR:  Error installing mechanize:
ERROR: Failed to build gem native extension.

/usr/bin/ruby2.0 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}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby2.0
--with-static-libstdc++
--without-static-libstdc++
--with-stdc++lib
--without-stdc++lib
/usr/share/ruby/2.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/mkmf.rb:519:in `try_link0'
from /usr/share/ruby/2.0/mkmf.rb:534:in `try_link'
from /usr/share/ruby/2.0/mkmf.rb:720:in `try_func'
from /usr/share/ruby/2.0/mkmf.rb:950:in `block in have_library'
from /usr/share/ruby/2.0/mkmf.rb:895:in `block in checking_for'
from /usr/share/ruby/2.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /usr/share/ruby/2.0/mkmf.rb:310:in `open'
from /usr/share/ruby/2.0/mkmf.rb:340:in `block in postpone'
from /usr/share/ruby/2.0/mkmf.rb:310:in `open'
from /usr/share/ruby/2.0/mkmf.rb:336:in `postpone'
from /usr/share/ruby/2.0/mkmf.rb:894:in `checking_for'
from /usr/share/ruby/2.0/mkmf.rb:945:in `have_library'
from extconf.rb:6:in `<main>'


Gem files will remain installed in /usr/local/share/ruby/gems/2.0/gems/unf_ext-0.0.7.2 for inspection.
Results logged to /usr/local/share/ruby/gems/2.0/gems/unf_ext-0.0.7.2/ext/unf_ext/gem_make.out

原文如下:

当我在我的 Amazon AWS Linux 虚拟机上运行 sudo gem install mechanize 时,出现此错误:

ERROR:  Error installing mechanize:
ERROR: Failed to build gem native extension.

/usr/bin/ruby2.0 extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/ruby/include/ruby.h


Gem files will remain installed in /usr/local/share/ruby/gems/2.0/gems/unf_ext-0.0.7.2 for inspection.
Results logged to /usr/local/share/ruby/gems/2.0/gems/unf_ext-0.0.7.2/ext/unf_ext/gem_make.out

当我运行 yum install ruby​​-dev 时,我收到以下消息:

Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest | 2.1 kB 00:00
amzn-updates/latest | 2.3 kB 00:00
No package ruby-dev available.
Error: Nothing to do

我想在这台机器上安装 Ruby gem Mechanize。我必须怎么做才能实现这一目标?

最佳答案

我必须先安装一堆包。

sudo yum install zlib-devel gcc gcc-c++ ruby​​-devel ruby​​gems

然后:

sudo gem install mechanize

关于ruby - 在 AWS Linux 上安装 Ruby gem Mechanize 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37107114/

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