Skip to content

Troubleshooting

Creating Temporary Swap File

If your system runs out of memory during compilation the OS will kill a program (based on a scoring system) to free up memory. This makes it look like a compiler error if the program that is killed is cc1plus, however it is actually just the system running out of memory.

You can run

$ free -h

to view current memory and swap file availability.

You can run the following commands to create a new swap file.

This one copies the swap file that exists by defaults

$ sudo dd if=/dev/zero of=/swapfile bs=64M count=16

This one makes it a swap file

$ sudo mkswap /swapfile

This command enables it

$ sudo swapon /swapfile

That should allow you to compile your code. However, make sure you revert the swapon after compilation with these:

$ sudo swapoff /swapfile

$ sudo rm /swapfile