windows 10 自带的 ubuntu 安装 g++ 遇到的问题Depends: g++-4.8 (>= 4.8.2-5~) but it is not going to be installed

 windows 10 自带 ubuntu 版本 

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:        16.04
Codename:       xenial

 

sudo apt-get install g++
Reading package lists... Done
Building dependency tree
Reading state information... Done
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:
 g++ : Depends: g++-4.8 (>= 4.8.2-5~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

下面把我解决这个问题遇到的所有解法都列一下,方便后面遇到相同问题的人填坑.

 

1.卸载掉装的4.8版本的gcc, 重新安装5

 

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5

这个行不通,第三步报错

The following packages have unmet dependencies:
 g++-5 : Depends: libstdc++-5-dev (= 5.5.0-12ubuntu1~16.04) but it is not going to be installed
         Depends: libisl15 (>= 0.15) but it is not installable
 gcc-5 : Depends: cpp-5 (= 5.5.0-12ubuntu1~16.04) but it is not going to be installed
         Depends: binutils (>= 2.26.1) but 2.24-5ubuntu14.2 is to be installed
         Depends: libisl15 (>= 0.15) but it is not installable
         Recommends: libc6-dev (>= 2.13-0ubuntu6) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

 

看了一下apt-get的原理, 他应该自动搞定所有依赖包, 但是由于源里面的版本啥的问题导致包不对也无法搞定自动安装, 所以换个源试试

换清华大学的源

https://blog.csdn.net/paincupid/article/details/52895676

还是报错 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

换山东大学的源

还是报错

The following packages have unmet dependencies:
 g++-5 : Depends: libstdc++-5-dev (= 5.5.0-12ubuntu1~16.04) but it is not going to be installed
 gcc-5 : Depends: binutils (>= 2.26.1) but 2.24-5ubuntu14.2 is to be installed
         Recommends: libc6-dev (>= 2.13-0ubuntu6) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

 

换阿里的源

E: Failed to fetch http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/pool/main/g/gcc-5/cpp-5_5.5.0-12ubuntu1~16.04_amd64.deb  Hash Sum mismatch

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

 

更新一下

apt-get update --fix-missing

重新安装, 提示安装过了

sudo apt-get install gcc-5 g++-5

sudo apt-get install gcc-5 g++-5
Reading package lists... Done
Building dependency tree
Reading state information... Done
g++-5 is already the newest version (5.5.0-12ubuntu1~16.04).
gcc-5 is already the newest version (5.5.0-12ubuntu1~16.04).
The following packages were automatically installed and are no longer required:
  gcc-4.8 libasan0 libgcc-4.8-dev libplymouth2
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 260 not upgraded.

 

 

安装node js , 提醒还是找不到g++

https://www.cnblogs.com/tianhei/p/7430050.html 安装nodejs 教程

make[1]: g++: Command not found
make[1]: *** [/root/node-v6.11.2/out/Release/obj.target/icuucx/deps/icu-small/source/common/appendable.o] Error 127
make[1]: Leaving directory `/root/node-v6.11.2/out'
make: *** [node] Error 2

 

然后再执行一下 apt-get install gcc 重新安装了

执行 apt-get install g++ 也重新安装了,还提示成功了.然后nodejs可以开始make了

 

也就是说 , 本质原因还是源的问题

 

 

 

 

 

 

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值