Why is the linker terminating on me? when i build CLang
Solution 1:
Your virtual machine does not have enough memory to perform the linking phase. Linking is typical the most memory intensive part of a build since it's where all the object code comes together and is operated on as a whole.
If you can allocate more RAM to the VM then do that. Alternatively you could increase the amount of swap space. I am not that familiar with VMs but I imagine the virtual hard drive you set-up will have a swap partition. If you can make that bigger or allocate a second swap partition that would help.
Increasing the RAM, if only for the duration of your build, is the easiest thing to do though.
Solution 2:
Also got the same issue and solved by doing following steps (It is memory issue only) -
- Checks current swap space by running free command (It must be around 10GB.).
-
Checks the swap partition
sudo fdisk -l /dev/hda8 none swap sw 0 0
-
Make swap space and enable it.
sudo swapoff -a sudo /sbin/mkswap /dev/hda8 sudo swapon -a
If your swap disk size is not enough you would like to create swap file and use it.
-
Create swap file.
sudo fallocate -l 10g /mnt/10GB.swap sudo chmod 600 /mnt/10GB.swap
OR
sudo dd if=/dev/zero of=/mnt/10GB.swap bs=1024 count=10485760 sudo chmod 600 /mnt/10GB.swap
-
Mount swap file.
sudo mkswap /mnt/10GB.swap
-
Enable swap file.
sudo swapon /mnt/10GB.swap