How to update gcc to the latest version(in this case 4.7) in Ubuntu 10.04?
I have Ubuntu 10.04 32-bit with gcc 4.4.3
currently installed on it. I want to upgrade it to gcc/g++ 4.7
(I am looking for C++ 0x support)
How to update using Ubuntu Package Manager:
apt-get upgrade/install ??
As a second option I downloaded the latest gcc snapshot file from:
http://gcc.cybermirror.org/snapshots/LATEST-4.7/gcc-4.7-20110709.tar.bz2
Would doing
./configure
make
make install
on this package build and install it from source?
Solution 1:
12.04
Add the toolchain ppa test repository, then do apt-get update, and apt-get dist-upgrade
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.7 c++-4.7
This is only available in 12.04 - older ubuntu versions cannot be updated to this same version using this method.
See here for further information about PPAs
https://help.launchpad.net/Packaging/PPA
Solution 2:
sudo apt-get install gcc-snapshot
Then, invoke it with:
/usr/lib/gcc-snapshot/bin/gcc
For the second part of the question, the answer is "yes, sort of". If you really want to do that (i.e. installing the gcc-snapshot package isn't enough) then you'll need to install the dependencies:
sudo apt-get build-dep gcc-snapshot
Then, find the correct configure options:
gcc -v
(and modify the install path etc.)
Then, build like this:
mkdir objdir
cd objdir
../gcc-src-dir/configure ......insert..options..here...
make
make install
Solution 3:
10.04 LTS
Use the following command to install add-apt-repository:
apt-get install python-software-properties
Then add the tooclain ppa test repo as described for 12.04 LTS.