gcc遇到依赖问题
libatomic1 : Depends: gcc-12-base (= 12-20220319-1ubuntu1) but 12.1.0-2ubuntu1~22.04 is to be installed
libc6-dev : Depends: libc6 (= 2.35-0ubuntu3) but 2.35-0ubuntu3.1 is to be installed
Depends: libtirpc-dev but it is not going to be installed
Depends: libnsl-dev but it is not going to be installed
libcc1-0 : Depends: gcc-12-base (= 12-20220319-1ubuntu1) but 12.1.0-2ubuntu1~22.04 is to be installed
libgomp1 : Depends: gcc-12-base (= 12-20220319-1ubuntu1) but 12.1.0-2ubuntu1~22.04 is to be installed
libhwasan0 : Depends: gcc-12-base (= 12-20220319-1ubuntu1) but 12.1.0-2ubuntu1~22.04 is to be installed
libitm1 : Depends: gcc-12-base (= 12-20220319-1ubuntu1) but 12.1.0-2ubuntu1~22.04 is to be installed
liblsan0 : Depends: gcc-12-base (= 12-20220319-1ubuntu1) but 12.1.0-2ubuntu1~22.04 is to be installed
当我准备安装gcc时,出现了依赖问题:
这里我首先做了尝试,按照其最后一行提示,进行损坏包的一个修复,不起效果:
apt --fix-broken install
继续尝试,安装gcc-12-base,好像还是不管用,我又卸载了gcc-12-base重新装了一遍还是不管用,反而问题变多了:
好,那就继续尝试,天无绝人之路,就是这样来的:
解决办法
apt-get install aptitude
aptitude install gcc g++
对,会帮助你产生解决方案,你只要选y/n就行,反正多试试总有一款适合你
第一次尝试,我选择了他这个方案,但是没用:
第二次尝试,我选择了 N,它换了一种方案:
然后我接受了这个方案,选择y:
一系列操作结束,输入gcc -v,完美解决:
问题出现,网上找了很多办法,但是都没办法解决,就只能一点一点试了,毕竟程序猿都是bug一点一点喂出来的。
版权声明:本文为weixin_45631845原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。