I'm studying linux now, so I have installed ubuntu 14.04(64bit),I want to update my gcc4.8.2 into gcc5.1.0,but it not work normally. My step are as follows.
First:
- xtrat "gcc-5.1.0.tar.gz" into /usr/lib
- Extrat "mpc-1.0.3.tar.gz" into /usr/lib/gcc-5.1.0/gcc_temp
- Extrat "mpfr-3.1.2.tar.gz" into /usr/lib/gcc-5.1.0/gcc_temp
- Extrat "gmp-6.0.0a.tar.bz2" into /usr/lib/gcc-5.1.0/gcc_tmp
- Second:
./configure --prefix=/usr/lib/gcc-5.1.0/gcc_temp/gmp-6.0.0 make make check make install
cd /usr/lib/gcc-5.1.0/gcc_temp/mpfr-3.1.2 ./configure --prefix=/usr/lib/gcc-5.1.0/gcc_temp/mpfr-3.1.2 --with-gmp=/usr/lib/gcc-5.1.0/gcc_temp/gmp-6.0.0 make make check make install
cd /usr/lib/gcc-5.1.0/gcc_temp/mpc-1.0.3 ./configure --prefix=/usr/lib/gcc-5.1.0/gcc_temp/mpc-1.0.3 --with-gmp=/usr/lib/gcc-5.1.0/gcc_temp/gmp-6.0.0 --with-mpfr=/usr/lib/gcc-5.1.0/gcc_temp/mpfr-3.1.2 make make check make install
- Third:
cd /usr/lib/gcc-5.1.0 ./configure --prefix=/usr/lib/gcc-5.1.0/gcc_temp --with-gmp=/usr/lib/gcc-5.1.0/gcc_temp/gmp-6.0.0 --with-mpc=/usr/lib/gcc-5.1.0/gcc_temp/mpc-1.0.3 --with-mpfr=/usr/lib/gcc-5.1.0/gcc_temp/mpfr-3.1.2 --enable-checking=release --enable-languages=c,c++ --disable-multilib make -j4 make install
- Finally
gcc --version gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Now I don't know why failed, My gcc version is gcc4.8.2 still!
--prefix
should point to where you want the compiler to be installed after it has been built. – Galikprefix=/usr/local
and reinstall. Your newest gcc should be in/usr/local/bin
. You can prepend this directory to your PATH if you want. You probably should also prepend/usr/local/lib
to yourLD_LIBRARY_PATH
, or alternatively add-Wl,-rpath=/usr/local/lib
option to gcc when you compile. – n. 1.8e9-where's-my-share m.