gcc 4.8 on Raspberry Pi Wheezy

Ever needed gcc/g++ 4.8 on your wheezy? Then do

sudo nano /etc/apt/sources.list

Change content to

deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
deb http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi
# Source repository to add
deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi
deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
deb http://archive.raspbian.org/raspbian jessie main contrib non-free rpi
# Source repository to add
deb-src http://archive.raspbian.org/raspbian jessie main contrib non-free rpi

Add preferences file

sudo nano /etc/apt/preferences

and insert

Package: *
Pin: release n=wheezy
Pin-Priority: 900
Package: *
Pin: release n=jessie
Pin-Priority: 300
Package: *
Pin: release o=Raspbian
Pin-Priority: -10

update package list

sudo apt-get update

Install gcc/g++ 4.8 from jessie repositories

sudo apt-get install -t jessie gcc-4.8 g++-4.8

To remove gcc/g++ alternative configuration (if there is any, there is none by default)

sudo update-alternatives --remove-all gcc 
sudo update-alternatives --remove-all g++

Install alternatives

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 20
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50

Now 4.8 is your default compiler. You can verify it by

sudo gcc --version

If you want to change it, you can

sudo update-alternatives --config gcc
sudo update-alternatives --config g++
Advertisements

Yet another headless CD-Ripper and MPD on Raspberry Pi installation guide (YAHCDRAMORPIG)

Another installation guide is written. I’m using my Raspberry Pi now with MPD on it and installed with the steps of this guide and everything seems to run as expected.

Here you can read more about it.