我一直在尝试在我的 Debian 机器上安装 g++ 7。我可以很容易地在我的 Mac 上安装它(因为自制软件有一个公式)。但是我似乎找不到在 Linux 上安装它的方法。
这个人有一个关于安装 g++ 4.9 的帖子,更改他给的 url 将我 带到这个页面,这似乎是在正确的方向……但我想以这种方式安装它可能会导致一些潜在的问题在路上当我想更新这些包时。
有我失踪的来源吗?或者是否有一个地方可以下载和编译运行它所需的一切?
谢谢您的帮助。
有用的数据:
我的内核是 x86_64 Linux 3.16.0-4-amd64。
编辑:在听从迪特里希的建议后,我现在遇到了一个新错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
gcc-7 : Depends: cpp-7 (= 7-20170316-1) but it is not going to be installed
Depends: libcc1-0 (>= 7-20170316-1) but it is not going to be installed
Depends: binutils (>= 2.28) but 2.25-5+deb8u1 is to be installed
Depends: libgcc-7-dev (= 7-20170316-1) but it is not going to be installed
Depends: libisl15 (>= 0.15) but it is not installable
Depends: libmpfr4 (>= 3.1.3) but 3.1.2-2 is to be installed
Depends: libstdc++6 (>= 5) but 4.9.2-10 is to be installed
E: Unable to correct problems, you have held broken packages.
这就是我的 sources.list 的设置方式:
#------------------------------------------------------------------------------#
# OFFICIAL DEBIAN REPOS
#------------------------------------------------------------------------------#
###### Debian Main Repos
deb http://ftp.us.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free
###### Debian Update Repos
deb http://security.debian.org/ jessie/updates main contrib non-free
deb http://ftp.us.debian.org/debian/ jessie-proposed-updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://ftp.us.debian.org/debian/ jessie-proposed-updates main contrib non-free
###### For ffmpeg
deb http://www.deb-multimedia.org jessie main non-free
###### For gcc-7 (Experimental)
deb http://httpredir.debian.org/debian experimental main
正如你所说,我猜这是我在 Debian stable 上的问题?我需要做什么才能修复此错误,同时保持稳定?
编辑2:好的,所以我发现了最后一个错误。我只需要为每个给我带来麻烦的单独依赖项添加遍历,并使用 apt-get install -t testing 安装它。感谢所有回复的人。你们都非常有帮助。
原文由 Robert D 发布,翻译遵循 CC BY-SA 4.0 许可协议
内核无关紧要。
GCC 7 尚未发布,您可以在 GCC 7 发行说明 中看到:
您可能想了解是什么让不同的 Linux 发行版有所不同。特别是,什么是 滚动发行 版,以及 Debian 发行版 的工作原理。在滚动发行版中,所有软件包都会不断更新到较新的版本。 Debian 8.7 (Jessie / stable) 不是 滚动发行版。软件包版本被冻结,仅在必要时更新,以获得额外的稳定性。 Debian 8.7 上最新的 GCC 版本是 GCC 4.9。
Debian 9.0 (Stretch / testing) 是 一个滚动版本,至少在它被冻结之前是这样。如果您将计算机切换到 Stretch,您将获得 GCC 6.3。
如果您需要更新的东西,您可以切换到 Sid(不稳定),或从 Sid 引脚封装。
但是,GCC 7 仅在实验 中可用,因为它尚未发布。如果您愿意,您可以从实验中安装单个软件包,请参阅 Debian Experimental 以获取说明。
如何
添加到您的
/etc/apt/sources.list
然后