How to install g ++ 4.9 on Debian Wheezy armel?

In my embedded system, the Debian 7 embedded kernel is currently g ++ 4.6, and I would like to upgrade to g ++ 4.9 to take advantage of the new features in C ++ 11. How to do this?

My current contents of sources.list:

     deb http://security.debian.org/ wheezy / updates main
     deb-src http://security.debian.org/ wheezy / updates main
     deb http://ftp.us.debian.org/debian wheezy main non-free
     deb-src http://ftp.us.debian.org/debian wheezy main non-free

Simple installation of apt-get package does not work:

     root @ arm: ~ # apt-get install g ++ - 4.9
     Reading package lists ... Done
     Building dependency tree
     Reading state information ... Done
     E: Unable to locate package g ++ - 4.9
     E: Couldn't find any package by regex 'g ++ - 4.9'

+8
arm c ++ 11 debian g ++
source share
3 answers

Another workaround would be to install the g ++ 4.9 packages from "Jessie", according to this blog post . In short, you will need to tell APT to use Jessie repositories when you install new g ++. First bring the current modern version of Wheezy:

sudo apt-get update sudo apt-get upgrade 

Then back up :-) and edit /etc/apt/sources.list to replace the string "wheezy" with "jessie" :

 sudo cp /etc/apt/sources.list /etc/apt/sources.list.WHEEZY sudo vi /etc/apt/sources.list 

Now update the package list and install version 4.9 of GCC / g ++:

 sudo apt-get update sudo apt-get install gcc-4.9 g++-4.9 

After that, return to the list of source packages:

 sudo cp /etc/apt/sources.list.WHEEZY /etc/apt/sources.list sudo apt-get update 

This leaves the original GCC, g ++ in place. If you want to compile version 4.9, either set the CC and CXX env tags respectively, or call the compilers like gcc-4.9 or g++-4.9 explicitly.

+12
source share

Probably required: packaging-dev , ubuntu-dev-tools

Pbuilder setup

(this allows you to create a package in chroot without polluting your system with build packages)

 sudo pbuilder create 

if you want to create for a specific distribution (pbuilder uses the build system release in chroot), you can use pbuilder-dist [exact / oneric / trusy / etc ...] create

Get debian source

 pull-debian-source gcc-4.9 [4.9.0-6] 

a specific version of debian is optional, but may be useful if you want to pull out experimental / unstable / test / stable versions you can also pull from specific ubuntu distributions by adding them to sources.list as deb-src and using sudo apt-get src

Package assembly

 sudo pbuilder build gcc-4.9_4.9.0-6.dsc 

In the downloaded files there is a .dsc file, for the most recent gcc it is gcc-4.9_4.9.0-6.dsc, which is the package descriptor file ..orig.tar. [gz / xz] is the original tarball.

Create a local Apt repository

 mkdir /convenient/place/for/repo cp /var/cache/pbuilder/result/* /path/to/repo cd /path/to/repo apt-ftp archive packages . > Packages sudo echo "deb [trusted=yes] file:/local/repo/Packages ./" > /etc/apt/sources.list.d/gcc-repo.list` 

Please note that you can also do this step with .debs downloaded from anywhere (skip step 1-3)

Installation

 apt-get update; apt-get install gcc-4.9 g++-4.9 
+6
source share

Instead of using jessie packages, it would be better to check if it has been ported back to hoarse. Add this to your /etc/apt/sources.list :

deb http://http.debian.net/debian wheezy-backports main

and do apt-get update and see if you can install it.

+1
source share

All Articles