在 Ubuntu 17.04 上尝试从源代码构建llvm 3.4时,我遇到了 与 gcc 6.3 (描述为here)相关的一些问题,所以我想使用 gcc-4.9 。 但是,当我从终端运行时:
sudo apt install gcc-4.9 --fix-missing
我收到以下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
cpp-4.9 gcc-4.9-base libasan1 libcloog-isl4 libgcc-4.9-dev
Suggested packages:
gcc-4.9-locales gcc-4.9-multilib gcc-4.9-doc libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan1-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg
libcilkrts5-dbg libquadmath0-dbg
The following NEW packages will be installed:
cpp-4.9 gcc-4.9 gcc-4.9-base libasan1 libcloog-isl4 libgcc-4.9-dev
0 upgraded, 6 newly installed, 0 to remove and 128 not upgraded.
Need to get 13.2 MB/13.2 MB of archives.
After this operation, 46.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Err:1 http://il.archive.ubuntu.com/ubuntu zesty/universe amd64 gcc-4.9-base amd64 4.9.4-2ubuntu1
404 Not Found
Err:2 http://il.archive.ubuntu.com/ubuntu zesty/universe amd64 cpp-4.9 amd64 4.9.4-2ubuntu1
404 Not Found
Err:3 http://il.archive.ubuntu.com/ubuntu zesty/universe amd64 libasan1 amd64 4.9.4-2ubuntu1
404 Not Found
Err:4 http://il.archive.ubuntu.com/ubuntu zesty/universe amd64 libgcc-4.9-dev amd64 4.9.4-2ubuntu1
404 Not Found
Err:5 http://il.archive.ubuntu.com/ubuntu zesty/universe amd64 gcc-4.9 amd64 4.9.4-2ubuntu1
404 Not Found
Unable to correct missing packages.
E: Failed to fetch http://il.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.9/gcc-4.9-base_4.9.4-2ubuntu1_amd64.deb 404 Not Found
E: Failed to fetch http://il.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.9/cpp-4.9_4.9.4-2ubuntu1_amd64.deb 404 Not Found
E: Failed to fetch http://il.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.9/libasan1_4.9.4-2ubuntu1_amd64.deb 404 Not Found
E: Failed to fetch http://il.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.9/libgcc-4.9-dev_4.9.4-2ubuntu1_amd64.deb 404 Not Found
E: Failed to fetch http://il.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.9/gcc-4.9_4.9.4-2ubuntu1_amd64.deb 404 Not Found
E: Aborting install.
这里发生了什么?谢谢!
答案 0 :(得分:5)
似乎gcc-4.9.4
确实从主存储库中丢失,而主存储库只有gcc-4.9.3
:
http://us.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.9
这解释了来自404 Not Found
的{{1}}错误
作为第一次修复尝试,您可以尝试以下操作,以防apt
能够修复的冲突:
apt
Ubuntu 16.04
在Ubuntu 16.04上,可以从Launchpad Toolchain存储库安装gcc-4.9:
sudo apt-get update --fix-missing
sudo apt-get dist-upgrade
sudo apt-get install gcc-4.9 g++-4.9 gcc-4.9-multilib
Ubuntu 18.04 (可能是17.10,17.04)
如果上述方法不起作用,您可以手动安装gcc-4.9以及所有必需的依赖项,方法是使用sudo apt-add-repository -yu 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main'
sudo apt update
sudo apt-get install gcc-4.9 g++-4.9 gcc-4.9-multilib
抓取所需的软件包并按顺序安装它们:
dpkg
以上在18.04进行了测试,并生成了功能已安装的gcc-4.9。
答案 1 :(得分:0)
使用Ubuntu 18.04 Bionic Beawer,我最终得到了一个相当肮脏的hack(比您在ubuntu土地上看到的要脏得多):
sudo -i apt update; aptitude full-upgrade cd /etc/apt sed 's/bionic/xential/g' < sources.list > sources.list-xential mv -v sources.list{,-bionic} ln -sv sources.list-xential sources.list apt update aptitude -y install gcc-4.9 g++-4.9 ln -svf sources.list-bionic sources.list apt update
这样,您可以使用软件包管理器和官方软件包。我没有破坏任何东西,因为apt不会在不需要的情况下降级。