1
votes

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!

1
Please don't extract and compile anything into folders where you need root permissions. You should be doing this in your $HOME folder.Galik
It's a bad idea to touch /usr/lib.n. 1.8e9-where's-my-share m.
What instructions did you follow?Galik
I recommend you follow these instructions here gcc.gnu.org/install. Read them all carefully before you begin. In particular --prefix should point to where you want the compiler to be installed after it has been built.Galik
I would recommend the following. Remove what you hace added to /usr/lib, reconfigure all components with prefix=/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 your LD_LIBRARY_PATH, or alternatively add -Wl,-rpath=/usr/local/lib option to gcc when you compile.n. 1.8e9-where's-my-share m.

1 Answers

0
votes

I have taken your steps and changed them to something that looks a lot more sane.

Before doing this try to install the pre-requisite libraries using the package manager that comes with your Linux Distro.

Extract "mpc-1.0.3.tar.gz" into $HOME/dev/
cd $HOME/dev/mpc-1.0.3
./configure --prefix=/usr/local
make
sudo make install

Extract "mpfr-3.1.2.tar.gz" into $HOME/dev/
cd $HOME/dev/mpfr-3.1.2
./configure --prefix=/usr/local
make
sudo make install

Extract "gmp-6.0.0a.tar.bz2" into $HOME/dev/
cd $HOME/dev/gmp-6.0.0a
./configure --prefix=/usr/local
make
sudo make install

Extract "gcc-5.1.0.tar.gz" into $HOME/dev/
cd $HOME/dev/gcc-5.1.0
./configure --prefix=/usr/local --program-suffix=-5.1.0 --enable-threads=posix --disable-bootstrap --enable-languages=c,c++ --disable-stage1-checking --disable-multilib
make
sudo make install

Please read through there instructions to fine tune your configuration: https://gcc.gnu.org/install/