如何在 Debian Wheezy armel 上安装 g++ 4.9? [英] How to install g++ 4.9 on Debian Wheezy armel?

查看:40
本文介绍了如何在 Debian Wheezy armel 上安装 g++ 4.9?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Debian 7 armel 嵌入式系统目前有 g++ 4.6,我想升级到 g++ 4.9 以使用新的 C++11 功能.我该怎么做?

我当前的sources.list内容是:

<前>deb http://security.debian.org/wheezy/updates maindeb-src http://security.debian.org/wheezy/updates maindeb http://ftp.us.debian.org/debian wheezy main 非免费deb-src http://ftp.us.debian.org/debian wheezy main 非免费

简单的 apt-get 安装包不起作用:

<前>root@arm:~# apt-get install g++-4.9阅读包裹清单...完成构建依赖树读取状态信息...完成E: 无法定位包 g++-4.9E: 无法通过正则表达式g++-4.9"找到任何包

解决方案

根据 这篇博文.简而言之,您必须在安装新 G++ 时告诉 APT 使用 Jessie 存储库.首先更新当前的 Wheezy:

sudo apt-get 更新sudo apt-get 升级

然后做一个备份 :-) 并编辑 /etc/apt/sources.list 以便将字符串 "wheezy" 替换为 "jessie":

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

现在更新包列表并安装4.9版本的GCC/G++:

sudo apt-get 更新须藤 apt-get 安装 gcc-4.9 g++-4.9

在恢复到原始"包列表之后:

sudo cp/etc/apt/sources.list.WHEEZY/etc/apt/sources.listsudo apt-get 更新

这保留了原来的 GCC,G++.如果您希望使用 4.9 版本进行编译,则相应地设置 CCCXX 环境变量或将编译器调用为 gcc-4.9g++-4.9 明确.

My Debian 7 armel embedded system currently has g++ 4.6, and I'd like to upgrade to g++ 4.9 to use new C++11 features. How do I do that?

My current sources.list contents is:


    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

A simple apt-get install of the 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'

解决方案

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.

这篇关于如何在 Debian Wheezy armel 上安装 g++ 4.9?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆