安装 CMake 错误: c++: internal compi
2018-02-06 本文已影响920人
闭眼卖布
根据 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
- 创建一个空文件
dd if=/dev/zero of=/media/fasthdd/swapfile.img bs=1024 count=1M
- Bake swap file:
mkswap /media/fasthdd/swapfile.img
- 开机时启动:
# 把下面这行加到 /etc/fstab
/media/fasthdd/swapfile.img swap swap sw 0 0
- 激活:
swapon /media/fasthdd/swapfile.img
验证是否成功:
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