본문 바로가기

라즈베리파이(RPI)

[버섯] 라즈베리 파이에 gcc 4.8버전 설치하기


안녕하세요 버섯돌이 유재성입니다.

아직 확정은 아니지만 허큘렉스나 다른 강좌에 사용하려는 추가 라이브러리가 빌드시 gcc 4.8 버전이 필요하더군요-_-;;;

라즈베리 wheezy버전에는 4.6 버전이 설치되어 있어서 apt-get 으로 설치하려고 보니 4.7까지뿐이 설치가 안되고..

인터넷을 찾아 봤는데 저장소 목록에 jessie라는 단어가 보이는데 이해가 잘 안되더군요.^^

(관련 글 : http://www.raspberrypi.org/forums/viewtopic.php?t=65516 )

그나마 아래 글이 저같은 초보들이 설치하기에는 가장 쉽게 되어있더군요.

 

키 포인트는 라즈비안의 저장소 목록인 /etc/apt/sources.list에 wheezy외에

raspbian jessie의 저장소 목록을 추가 후 업데이트 하면 gcc 4.8 버전을 설치 할 수 있습니다.

 






 

네이버는 가로 화면이 740을 넘어가면 안 이쁘게 축소되다보니 Putty 창을 작게 줄였는데..

크.. 기존에 출력된 글자가 죄다 잘려 버렸군요..^^;;;

그래서 마지막 명령어는 빨간색으로 표시하지 않았습니다.

 

기존에 별다른 설정없이 사용해서 그런지 초반의 alternatives 명령에는 에러가 나오지만

최종적으로 설치된 버전을 확인해보면 4.8.2 버전이 설치되어있습니다^^

혹시라도 g++ 버전의 업글이 필요하신 분들은 참고 하시기 바랍니다.

 

출처 : http://somewideopenspace.wordpress.com/2014/02/28/gcc-4-8-on-raspberry-pi-wheezy/

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 rpideb http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi# Source repository to adddeb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free rpideb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpideb http://archive.raspbian.org/raspbian jessie main contrib non-free rpi# Source repository to adddeb-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=wheezyPin-Priority: 900Package: *Pin: release n=jessiePin-Priority: 300Package: *Pin: release o=RaspbianPin-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 20sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20sudo 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 gccsudo update-alternatives --config g++