ruby - 错误 : failed to build gem native extension, Linux 虚拟机

标签 ruby linux amazon-web-services mechanize

我在 Linux AWS 上运行 Ruby 2.0.0p645。

我尝试运行 gem install mechanize,但出现此错误:

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

    /usr/bin/ruby2.0 extconf.rb
checking for main() in -lstdc++... no
creating Makefile

make "DESTDIR="
g++ -I. -I/usr/include/ruby/2.0 -I/usr/include/ruby/2.0/ruby/backward -I/usr/include/ruby/2.0 -I.   -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -m64 -o unf.o -c unf.cc
make: g++: Command not found
make: *** [unf.o] Error 127


Gem files will remain installed in /path/to/.gem/ruby/2.0/gems/unf_ext-0.0.7.1 for inspection.
Results logged to /path/to/.gem/ruby/2.0/gems/unf_ext-0.0.7.1/ext/unf_ext/gem_make.out

我该如何解决这个问题,以便我可以在我的虚拟盒子上安装 mechanize

最佳答案

看起来您可能需要安装 libstdc++。对于 Debian 或 Ubuntu,请尝试:

sudo apt-get install build-essential libstdc++6 

然后重试安装 gem。

关于ruby - 错误 : failed to build gem native extension, Linux 虚拟机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31343242/

相关文章:

linux - 处理 kmalloc 返回的优化

ruby-on-rails - 如何验证json中的唯一性?

ruby-on-rails - 在 Rails 5.2 中分离 secret_key_base?

linux - 在手册页中使用 <> 来指示可选的空格

linux - bash 语句末尾的 "-;"是什么意思?

amazon-web-services - 从控制台备份/版本控制 AWS AppSync

amazon-web-services - aws cloudwatch指标覆盖/覆盖

angular - 使用 AWS Amplify 构建 Angular 10 应用程序时出错

ruby - 如何将 "zip"两个数组转化为hash

ruby - 遍历 ENV 并将结果写入 Chef 中的文件