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了
也就是说 , 本质原因还是源的问题