简体   繁体   English

错误:无法构建gem本机扩展,Linux虚拟机

[英]ERROR: failed to build gem native extension, Linux virtual machine

I'm running Ruby 2.0.0p645 on a Linux AWS. 我在Linux AWS上运行Ruby 2.0.0p645。

I tried running gem install mechanize , but got this error: 我尝试运行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

How do I fix this so I can install mechanize on my virtual box? 如何解决此问题,以便可以在虚拟盒子上安装mechanize

Looks like you might need to install libstdc++. 看起来您可能需要安装libstdc ++。 For Debian or Ubuntu try: 对于Debian或Ubuntu,请尝试:

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

and then retry installing the gem. 然后重试安装gem。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM