It's been years since we got into the code farming era, has not written the habit of blogging, used a lot of things no record, to the back of the forgotten, need to use, and constantly Baidu Google, time and energy, not necessarily can find a satisfactory answer, so open a blog record. (No more nonsense)
Today on the company server source code installation NODEJS error warning:c++ compiler too old, need g++ 4.8 or clang++ 3.4 (cxx=g++), direct yum update GCC can not upgrade to 4.8, and can only manually Disposed of.
Start, if Linux installs the wget command:
wget http://ftp.gnu.org/gnu/gcc/gcc-6.1.0/gcc-6.1.0.tar.gz
tar-zvxf gcc-6.1.0.tar.gz--directory=/usr/local/
cd/usr/local/gcc-6.1.0
./contrib/download_prerequisites
mkdir build && CD build
. /configure-enable-checking=release-enable-languages=c,c++-disable-multilib make
&& make install
If it is installed on a virtual machine, it may take more than 3-4 hours to wait patiently, juvenile ...
If, if your Linux is very strong, do not install wget command, or can not access the extranet, how to do??? Keep looking down:
First download the latest GCC (http://ftp.gnu.org/gnu/gcc/), I used the gcc-6.1.0.tar.gz, uploaded to Linux via FTP, decompression:
TAR-ZVXF gcc-6.1.0.tar.gz--directory=/usr/local/
cd/usr/local/gcc-6.1.0
Then use VI to open the./contrib/download_prerequisites file to see which dependencies you need for the currently downloaded GCC. When you open it, you see the following:
From this, we also need to download gmp-4.3.2.tar.bz2, isl-0.15.tar.bz2, mpc-0.8.1.tar.gz, mpfr-2.4.2.tar.bz2, note that the dependency package must be specified version, otherwise there will be problems. Download a good dependency package, extract directly to the/usr/local/gcc-6.1.0/directory, and then set up soft Links:
LN-SF gmp-4.3.2 GMP
ln-sf isl-0.15 ISL
ln-sf mpc-0.8.1 MPC
ln-sf mpfr-2.4.2 MPFR
Once you have set it up, you are ready to start installing:
mkdir build && CD Build
... /configure-enable-checking=release-enable-languages=c,c++-disable-multilib make
&& make install
The above is a small set to introduce the Linux CentOS 6.5 manual upgrade gcc to gcc-6.1.0, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!