Why is the linker terminating on me? when i build CLang
GccLinkerGcc Problem Overview
I am using opensuse, specific the variant on mono's website when you click vmware
I get this error. Does anyone know how i might fix it?
make[4]: Entering directory `/home/rupert/Desktop/llvm/tools/clang/tools/driver'
llvm[4]: Linking Debug+Asserts executable clang
collect2: ld terminated with signal 9 [Killed]
make[4]: *** [/home/rupert/Desktop/llvm/Debug+Asserts/bin/clang] Error 1
The full text can be found here
Gcc Solutions
Solution 1 - Gcc
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 - Gcc
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
Solution 3 - Gcc
I tried with make -j1 and it works!. But it takes long time to build.
Solution 4 - Gcc
I had the same problem building on a VirtualBox system. FWIW I was building on a laptop with XP and 2GB RAM. I had to bump the virtual RAM up to 1462MB to get a successful build. Also note the recommended disk size of 8GB is not sufficient to build and install both LLVM and Clang under Ubuntu. I'd recommend at least 16GB.
Solution 5 - Gcc
I would suggest using of -l (--max-load)
option instead of limiting -j
in this case. Possibly helpful
answer.