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

拟墨画扇 提交于 2019-12-03 11:49:42

Another workaround could be to install the g++ 4.9 packages from "Jessie", according to this blog post. Briefly, you would have to tell APT to use the Jessie repos while you are installing the new G++. First bring the current Wheezy up-to-date:

sudo apt-get update
sudo apt-get upgrade

Then do a backup :-) and edit /etc/apt/sources.list so that you 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 the 4.9 version of GCC/G++:

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

After this revert to the "original" package list:

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 wish to compile with the 4.9 version, then either set the CC and CXX env vars accordingly or invoke the compilers as gcc-4.9 or g++-4.9 explicitly.

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

Set up pbuilder

(this lets you build a package in a chroot without polluting your system with build-dependency packages)

sudo pbuilder create

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

Get debian source

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

specific debian revision is optional, but can be useful if you want to pull experimental/unstable/testing/stable revisions you can also pull from specific ubuntu distros by adding them to sources.list as a deb-src and using sudo apt-get src

Build Package

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

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

Create 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`

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

Install

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

Instead of using the jessie packages, it would be better to check to see if it's been back-ported to wheezy. Add this to your /etc/apt/sources.list:

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

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

There is a gcc-4.9-backport now.

sudo apt-get update && sudo apt-get install gcc-4.9-backport
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!