首页 > 代码库 > 安装lxml时gcc: internal compiler error: Killed (program cc1)的解决方法

安装lxml时gcc: internal compiler error: Killed (program cc1)的解决方法

在安装lxml时出现如下错误

gcc: internal compiler error: Killed (program cc1)

通过查看dmesg发现下述错误信息
[2517343.500178] Out of memory: Kill process 5051 (cc1) score 632 or sacrifice child
[2517343.501833] Killed process 5051 (cc1) total-vm:471664kB, anon-rss:326648kB, file-rss:0kB
[2517441.995124] systemd-journald[233]: Vacuuming done, freed 4194304 byte

看来主要问题是因为内存不足导致的,为解决该问题通过增加swap分区来解决,具体方法如下:

sudo mkdir -p /var/cache/swap/sudo dd if=/dev/zero of=/var/cache/swap/swap0 bs=1M count=512sudo chmod 0600 /var/cache/swap/swap0sudo mkswap /var/cache/swap/swap0 sudo swapon /var/cache/swap/swap0


参考资料:
http://stackoverflow.com/questions/19761226/how-to-compile-ruby-with-rvm-on-a-low-memory-system
https://github.com/pydata/pandas/issues/1880#issuecomment-9920484

安装lxml时gcc: internal compiler error: Killed (program cc1)的解决方法