简体   繁体   中英

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

I'm running Ruby 2.0.0p645 on a Linux AWS.

I tried running gem install mechanize , but got this error:

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?

Looks like you might need to install libstdc++. For Debian or Ubuntu try:

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

and then retry installing the gem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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