Node.js 4.2.3 just came out, and we want to install or upgrade to this version. But since I’m forced to operate on a CentOS machine I was saddened to see this when attempting to configure:

WARNING: C++ compiler too old, need g++ 4.8 or clang++ 3.4 (CXX=g++)

With great regret, I set about figuring out how to install (read: build) newer compiler tools for a distribution that is very slow to change, but lo! I was pleasantly surprised to find out that Scientific Linux had me covered!

All you have to do to get a modern version of G++ is:

sudo curl http://linuxsoft.cern.ch/cern/scl/slc6-scl.repo > /etc/yum.repos.d/slc6-scl.repo
sudo rpm --import http://ftp.mirrorservice.org/sites/ftp.scientificlinux.org/linux/scientific/51/i386/RPM-GPG-KEYs/RPM-GPG-KEY-cern
sudo yum install -y devtoolset-3

And to utilize it without having to set environment variables:

scl enable devtoolset-3 bash

You have a shell with access to G++ 4.9 and Node.js is happy. For completeness, here’s what to do to compile it:

wget https://nodejs.org/dist/v4.2.3/node-v4.2.3.tar.gz
tar xvzf node-v4.2.3.tar.gz
cd node-v4.2.3
./configure
make
sudo make install

Original post from: krisreeves.com by krisreeves.

About The Author