How can I install GCC 4.8 on Raspberry Pi? Do I need to compile it from source? Should I update from Raspbian wheezy to a newer version?
As long as your Raspberry Pi is up to date, then you can just download and patch GCC 4.8 to run on you Raspberry Pi.
Download GCC sources
$ wget ftp://ftp.fu-berlin.de/unix/languages/gcc/snapshots/LATEST-4.8/*.bz2
$ tar xf gcc-4.8-20120826.tar.bz2
We need to get and apply two debian specific patches for GCC:
$ wget http://anonscm.debian.org/viewvc/gcccvs/branches/sid/gcc-4.7/debian/patches/armhf-triplet.diff?view=co -O armhf-triplet.diff $ wget http://anonscm.debian.org/viewvc/gcccvs/branches/sid/gcc-4.7/debian/patches/gcc-multiarch-trunk.diff?view=co -O gcc-multiarch-trunk.diff $ cd gcc-4.8-20120826 $ patch -p2 -i ../armhf-triplet.diff $ patch -p2 -i ../gcc-multiarch-trunk.diff
Note: There will be a failed patch in libgcc, don't worry about it, as it's already been applied to gcc-4.8.
$ cd gcc $ autoconf2.64 $ cd ../libjava $ autoconf2.64 $ cd ../
Compile and install GCC:
In 2015-02-16-raspbian-wheezy is gcc-4.8 already as package (4.8.2), but not default. You can install it apt-get install gcc-4.8 g++-4.8 and then change the links in /usr/bin/
I tried the above -- ran into several issues. This might be easier (I'm trying it now):