我在 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/