[Solved] internal compiler error Killed (program cc1plus)

g++: internal compiler error: Killed (program cc1plus)

g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
gmake: *** [cmGeneratorTarget.o] Error 4
---------------------------------------------
Error when bootstrapping CMake:
Problem while running gmake
---------------------------------------------
Log of errors: /root/cmake-3.22.0/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------

The reason is insufficient memory. The solution is to increase swap partition

[root@ALiYunOgenes cmake-3.22.0]# free -h
              total        used        free      shared  buff/cache   available
Mem:           991M        465M        257M        1.1M        268M        379M
Swap:            0B          0B          0B
[root@ALiYunOgenes cmake-3.22.0]# dd if=/dev/zero of=/var/swap bs=1024 count=2048000  
2048000+0 records in
2048000+0 records out
2097152000 bytes (2.1 GB) copied, 19.0987 s, 110 MB/s

[root@ALiYunOgenes cmake-3.22.0]# mkswap /var/swap 
Setting up swapspace version 1, size = 2047996 KiB
no label, UUID=d5ede89f-d76a-4b53-9ec9-256a9370fcfe

[root@ALiYunOgenes cmake-3.22.0]# swapon /var/swap 
swapon: /var/swap: insecure permissions 0644, 0600 suggested.
[root@ALiYunOgenes cmake-3.22.0]# vi /etc/fstab 
…………
/var/swap swap swap defaults 0 0
…………

[root@ALiYunOgenes cmake-3.22.0]# free -m          
              total        used        free      shared  buff/cache   available
Mem:            991         466          58           1         465         374
Swap:          1999           0        1999
[root@ALiYunOgenes cmake-3.22.0]# 

Read More: