CentOS 5: make: g++: Command not found

You might see thisĀ error when attempting to install various packages or gems on CentOS Linux. I noticed it when attempting to install the ruby gem named eventmachine. After installing one RPM package via yum I no longer received the error when attempting to install the eventmachine gem.

EventMachine Gem Install Error Noticed:

bash

  1. [root@server]# gem install eventmachine
  2. Building native extensions. This could take a while...
  3. ERROR: Error installing eventmachine:
  4. ERROR: Failed to build gem native extension.
  5.  
  6. /usr/local/bin/ruby extconf.rb install eventmachine
  7. checking for main() in -lpthread... yes
  8. checking for sys/epoll.h... yes
  9. checking for rb_thread_blocking_region()... no
  10. checking for main() in -lcrypto... yes
  11. checking for main() in -lssl... yes
  12. checking for main() in -lcrypto... yes
  13. checking for openssl/ssl.h... yes
  14. checking for openssl/err.h... yes
  15. creating Makefile
  16.  
  17. make
  18. g++ -I. -I. -I/usr/local/lib/ruby/1.8/i686-linux -I. -DHAVE_SYS_EPOLL_H -DHAVE_OPENSSL_SSL_H -DHAVE_OPENSSL_ERR_H -I/include/include -DOS_UNIX -DBUILD_FOR_RUBY -DHAVE_EPOLL -DWITH_SSL -fPIC -g -O2 -c binder.cpp
  19. make: g++: Command not found
  20. make: *** [binder.o] Error 127
  21.  
  22. Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.0 for inspection.
  23. Results logged to /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.12.0/ext/gem_make.out

Just install the gcc-c++ package via yum as shown below. After installing the gcc-c++ RPM package you should be able to now install the eventmachine gem without issue.

Install gcc-c++ Package Using Yum On CentOS Linux:

bash

  1. Install Command: yum install gcc-c++

The Definitive Guide to CentOS (Books for Professionals by Professionals) (Paperback)


List Price: $39.99 USD
New From: $25.00 USD In Stock
Used from: $4.29 USD In Stock

Foundations of CentOS Linux: Enterprise Linux On the Cheap (Books for Professionals by Professionals) (Paperback)


List Price: $42.99 USD
New From: $24.99 USD In Stock
Used from: $10.38 USD In Stock

Share