我最近全新安装了 Ubuntu,在尝试安装 gcc-4.8 时遇到了麻烦,我尝试了几种不同的方法,现在我只能回到原来的位置。
#> sudo apt-get install build-essential
The following packages have unmet dependencies.
build-essential : Depends: gcc (>= 4:4.4.3) but it is not going to be installed
Depends: g++ (>= 4:4.4.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
#> sudo apt-get install gcc
The following packages have unmet dependencies.
gcc : Depends: gcc-4.8 (>= 4.8.1-4~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我已尽可能多地删除了与 gcc 相关的内容。我认为目前安装的唯一 gcc-* 包是 gcc-4.8-base:amd64,但如果我尝试删除它:
libgcc1 : Depends: gcc-4.8-base (= 4.8.2-1ubuntu1) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
同样,唯一安装的 libgcc-* 包是 libgcc1:amd64 ,我尝试删除它:
The following packages have unmet dependencies.
libc6 : Depends: libgcc1 but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
尝试删除任何与 libc6 相关的内容会给我一些看起来很可怕的选项并且没有意义。
这是我目前的 sources.list,我已禁用某些内容并进行了更新。
# deb cdrom:[Kubuntu 13.10 _Saucy Salamander_ - Release amd64 (20131016.1)]/ saucy main multiverse restricted universe
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://gb.archive.ubuntu.com/ubuntu/ saucy main restricted
deb-src http://gb.archive.ubuntu.com/ubuntu/ saucy main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://gb.archive.ubuntu.com/ubuntu/ saucy-updates main restricted
deb-src http://gb.archive.ubuntu.com/ubuntu/ saucy-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://gb.archive.ubuntu.com/ubuntu/ saucy universe
deb-src http://gb.archive.ubuntu.com/ubuntu/ saucy universe
deb http://gb.archive.ubuntu.com/ubuntu/ saucy-updates universe
deb-src http://gb.archive.ubuntu.com/ubuntu/ saucy-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://gb.archive.ubuntu.com/ubuntu/ saucy multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu/ saucy multiverse
deb http://gb.archive.ubuntu.com/ubuntu/ saucy-updates multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu/ saucy-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://gb.archive.ubuntu.com/ubuntu/ saucy-backports main restricted universe multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu/ saucy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu saucy-security main restricted
deb-src http://security.ubuntu.com/ubuntu saucy-security main restricted
deb http://security.ubuntu.com/ubuntu saucy-security universe
deb-src http://security.ubuntu.com/ubuntu saucy-security universe
deb http://security.ubuntu.com/ubuntu saucy-security multiverse
deb-src http://security.ubuntu.com/ubuntu saucy-security multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu saucy partner
# deb-src http://archive.canonical.com/ubuntu saucy partner
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
# deb http://extras.ubuntu.com/ubuntu saucy main
# deb http://archive.canonical.com/ saucy partner
# deb-src http://archive.canonical.com/ saucy partner
# deb-src http://extras.ubuntu.com/ubuntu saucy main
# deb-src http://archive.canonical.com/ saucy partner
我不明白 apt 的错误。我对 apt 了解甚少。错误消息毫无意义,我不明白为什么多个版本的 gcc 不能共存(它们在以前的安装中可以共存)或者任何已安装的软件包如何可能阻止安装其他软件包。我不知道如何获取有关该问题的更多信息。
目前我的目标是摆脱所有与 gcc-4.8 相关的东西,只安装标准 gcc(无论哪个版本)。我该怎么做?
谢谢
答案1
使用 aptitude 而不是 apt-get 我可以降级现有软件包,然后正常安装。
答案2
谷歌搜索你的错误发现Ask Ubuntu 上的答案—— 似乎你已经“持有”一个早期版本的软件包(我敢打赌是 GCC),这导致apt-get
无法解决需要较新版本的依赖关系。
要取消保留该包裹,请点击该答案评论中的链接,它会带你到那里回答的另一个问题。