通过 do-release-upgrade 从 Ubuntu 14 升级到 Ubuntu 16 时,我遇到了以下重定位错误:
apt-get: relocation error: /usr/lib/x86_64-linux-gnu/libapt-pkg.so.5.0: symbol _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareERKS4_, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference
正如这里所述。https://github.com/Microsoft/WSL/issues/1216
无法再使用 apt。我通过安装解决了这个问题(如上面的链接所示):
sudo dpkg -i libstdc++6_5.4.0-6ubuntu1~16.04.12_amd64.deb
现在,apt 可以再次工作了,但是依赖关系却被破坏了:
libstdc++-5-dev : Depends: libstdc++6 (>= 5.5.0-12ubuntu1~14.04) but 5.4.0-6ubuntu1~16.04.12 is installed
libstdc++-6-dev : Depends: libstdc++6 (>= 6.5.0-2ubuntu1~14.04.1) but 5.4.0-6ubuntu1~16.04.12 is installed
libstdc++-7-dev : Depends: libstdc++6 (>= 7.5.0-3ubuntu1~14.04.1) but 5.4.0-6ubuntu1~16.04.12 is installed
libstdc++6 : Depends: gcc-5-base (= 5.4.0-6ubuntu1~16.04.12) but 5.5.0-12ubuntu1~14.04 is installed
有人知道如何解决这个问题吗?
似乎升级过程没有正确地将 gcc5 从 trusty 升级到 xenial,请参阅:
sudo dpkg --list gcc-5
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============================================-============================-============================-=================================================================================================
ii gcc-5 5.5.0-12ubuntu1~14.04 amd64 GNU C compiler
提前致谢!
答案1
好的,我刚刚找到了解决方案。以下是遇到类似问题的人的答案:
wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/libstdc++6_5.4.0-6ubuntu1~16.04.12_amd64.deb
sudo dpkg -i libstdc++6_5.4.0-6ubuntu1~16.04.12_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/gcc-5-base_5.4.0-6ubuntu1~16.04.12_amd64.deb
sudo dpkg -i gcc-5-base_5.4.0-6ubuntu1~16.04.12_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/gcc-5_5.4.0-6ubuntu1~16.04.12_amd64.deb
sudo dpkg -i gcc-5_5.4.0-6ubuntu1~16.04.12_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/g++-5_5.4.0-6ubuntu1~16.04.12_amd64.deb
sudo dpkg -i g++-5_5.4.0-6ubuntu1~16.04.12_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/cpp-5_5.4.0-6ubuntu1~16.04.12_amd64.deb
sudo dpkg -i cpp-5_5.4.0-6ubuntu1~16.04.12_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/libstdc++-5-dev_5.4.0-6ubuntu1~16.04.12_amd64.deb
sudo dpkg -i libstdc++-5-dev_5.4.0-6ubuntu1~16.04.12_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/libgcc-5-dev_5.4.0-6ubuntu1~16.04.12_amd64.deb
sudo dpkg -i libgcc-5-dev_5.4.0-6ubuntu1~16.04.12_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/libasan2_5.4.0-6ubuntu1~16.04.12_amd64.deb
sudo dpkg -i libasan2_5.4.0-6ubuntu1~16.04.12_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/libmpx0_5.4.0-6ubuntu1~16.04.12_amd64.deb
sudo dpkg -i libmpx0_5.4.0-6ubuntu1~16.04.12_amd64.deb
sudo apt -f install
sudo apt autoremove
这让我处于一个干净的状态。
附注:apt -f install 只需删除仍然出错的 gcc-6 和 gcc-7 即可解决剩余的错误
The following packages have unmet dependencies:
libstdc++-6-dev : Depends: libstdc++6 (>= 6.5.0-2ubuntu1~14.04.1) but 5.4.0-6ubuntu1~16.04.12 is installed
libstdc++-7-dev : Depends: libstdc++6 (>= 7.5.0-3ubuntu1~14.04.1) but 5.4.0-6ubuntu1~16.04.12 is installed
但对 trusty 来说并不是关键。与 gcc-5 相比,调用 apt -f install 会删除数千个软件包,包括 apt 等。