Ubuntu16.04 编译错误 c++: internal compiler error: Killed (program cc1plus)
编译错误 c++: internal compiler error: Killed (program cc1plus)
错误描述
在大疆manifold-2G 上源码安装pytorch时出现编译错误

解决办法
ubuntu使用cmake编译时比较耗费内存,可以查看下内存使用情况
- 查看swap和memory的空间使用情况
$ free -h

可以看出没有开辟swap空间,下面尝试开辟swap空间
- 创建 swap file 大小为2G
$ sudo fallocate -l 2G /swapfile
- 查看swapfile
$ ls -lh /swapfile
- 修改文件权限,只能被root访问
$ sudo chmod 600 /swapfile
$ ls -lh /swapfile
- 标记文件空间
sudo mkswap /swapfile

执行效果
继续执行源码编译程序,编译内存空间不足问题解决。

参考文章
https://blog.csdn.net/sinat_31220673/article/details/95351169?spm=1001.2014.3001.5502