Posted at

Amazon Linux に g++ を入れる。

More than 5 years have passed since last update.


起こったこと

therubyracerを入れていると、g++が無いと怒られる。

DEBUG [2263cd48]    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

DEBUG [2263cd48]
DEBUG [2263cd48] /home/username/.rbenv/versions/2.1.1/bin/ruby extconf.rb
DEBUG [2263cd48] checking for main() in -lpthread... yes
DEBUG [2263cd48] creating Makefile
DEBUG [2263cd48]
DEBUG [2263cd48] make "DESTDIR=" clean
DEBUG [2263cd48]
DEBUG [2263cd48] make "DESTDIR="
DEBUG [2263cd48] compiling handles.cc
DEBUG [2263cd48] make: g++: Command not found
DEBUG [2263cd48] make: *** [handles.o] Error 127
DEBUG [2263cd48]
DEBUG [2263cd48] make failed, exit code 2
DEBUG [2263cd48]
DEBUG [2263cd48] Gem files will remain installed in /home/username/production/shared/bundle/ruby/2.1.0/gems/therubyracer-0.12.0 for inspection.
DEBUG [2263cd48] Results logged to /home/username/production/shared/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/therubyracer-0.12.0/gem_make.out
DEBUG [2263cd48] An error occurred while installing therubyracer (0.12.0), and Bundler cannot
DEBUG [2263cd48] continue.
DEBUG [2263cd48] Make sure that `gem install therubyracer -v '0.12.0'` succeeds before bundling.


解決法

$ sudo yum install gcc-g++