安装 CMake 错误: c++: internal compiler error: Killed (program cc1plus)

本文介绍了一种在安装CMake过程中遇到的内部编译器错误,并提供了详细的解决方案,包括如何通过增加交换空间来解决内存不足的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

根据 https://cmake.org/install/ 安装 CMake 时, 在运行完 ./bootstrap 的过程中出现这个错误:

c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
Source/CMakeFiles/CMakeLib.dir/build.make:1622: recipe for target 'Source/CMakeFiles/CMakeLib.dir/cmGeneratorTarget.cxx.o' failed
make[2]: *** [Source/CMakeFiles/CMakeLib.dir/cmGeneratorTarget.cxx.o] Error 4
CMakeFiles/Makefile2:2306: recipe for target 'Source/CMakeFiles/CMakeLib.dir/all' failed
make[1]: *** [Source/CMakeFiles/CMakeLib.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

c++: internal compiler error: Killed (program cc1plus) 这个错误通常是因为 memory 不够, 解决方法增加 swap space.

怎么增加 swap space? https://askubuntu.com/questions/178712/how-to-increase-swap-space

1. 创建一个空文件

dd if=/dev/zero of=/media/fasthdd/swapfile.img bs=1024 count=1M

2. Bake swap file:

mkswap /media/fasthdd/swapfile.img

3. 开机时启动:

# 把下面这行加到 /etc/fstab
/media/fasthdd/swapfile.img swap swap sw 0 0

4. 激活:

swapon /media/fasthdd/swapfile.img

5. 验证是否成功:

cat /proc/swaps
  Filename                           Type       Size    Used    Priority
  /media/fasthdd/swapfile.img        file       8388604 2724    -1

grep 'Swap' /proc/meminfo
  SwapCached:         4772 kB
  SwapTotal:       8388604 kB
  SwapFree:        8355812 kB
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值