![在 Ubuntu14.04LTS 上安装 gcc4.9 出现“哈希总和不匹配”错误](https://linux22.com/image/1141498/%E5%9C%A8%20Ubuntu14.04LTS%20%E4%B8%8A%E5%AE%89%E8%A3%85%20gcc4.9%20%E5%87%BA%E7%8E%B0%E2%80%9C%E5%93%88%E5%B8%8C%E6%80%BB%E5%92%8C%E4%B8%8D%E5%8C%B9%E9%85%8D%E2%80%9D%E9%94%99%E8%AF%AF.png)
我尝试在 Ubuntu 14.04 上安装 gcc4.9 并运行:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
出现以下错误:
...
W: Failed to fetch http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/trusty/main/binary-amd64/Packages Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead
我输入http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/trusty/main/binary-amd64/Packages进入浏览器得到“未找到”的答复。
尝试再安装:
sudo apt-get install gcc-4.9
以下内容:
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-4.9:i386 : Depends: cpp-4.9:i386 (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
Depends: gcc-4.9-base:i386 (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
Depends: binutils:i386 (>= 2.24) but it is not going to be installed
Depends: libgcc-4.9-dev:i386 (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
Depends: libc6:i386 (>= 2.11) but it is not going to be installed
Depends: libcloog-isl4:i386 (>= 0.17) but it is not going to be installed
Depends: libgmp10:i386 but it is not installable
Depends: libisl15:i386 (>= 0.15) but it is not going to be installed
Depends: libmpc3:i386 but it is not installable
Depends: libmpfr4:i386 (>= 3.1.3) but it is not going to be installed
Depends: zlib1g:i386 (>= 1:1.1.4) but it is not installable
Recommends: libc6-dev:i386 (>= 2.13-0ubuntu6) but it is not going to be installed
由于“哈希值不匹配”错误,无法下载软件包列表——这对我不起作用。
任何建议对我来说都很有用:-)
答案1
如果你将 URL 修剪回文件夹,像这样
http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/trusty/main/binary-amd64/
然后它在浏览器中就可以工作了,你可以看到 Packages 文件有一个 gzip 和 bzip2 压缩副本。你可以下载这个文件并将其放在 /var/cache/apt/archives/list 或 /var/cache/apt/archives/ 中,这样可能会跳过失败的步骤。
更新:查看 ppa 的页面,我发现还有另一个链接效果更好,试试这个
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa