51

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

5 Answers5

51

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.

Troubadour
  • 13,334
  • 2
  • 38
  • 57
  • 1
    If you are on CentOS or a related distro, you can follow [this tutorial](http://www.techotopia.com/index.php/Adding_and_Managing_CentOS_Swap_Space) to add a swap file. This solved the issue for me. – sffc May 13 '14 at 10:18
42

Also got the same issue and solved by doing following steps (It is memory issue only) -

  1. Checks current swap space by running free command (It must be around 10GB.).
  2. Checks the swap partition

    sudo fdisk -l
    /dev/hda8       none            swap    sw              0       0
    
  3. 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.

  1. 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
    
  2. Mount swap file.

    sudo mkswap /mnt/10GB.swap
    
  3. Enable swap file.

    sudo swapon /mnt/10GB.swap
    
Nate
  • 18,752
  • 8
  • 48
  • 54
Gaurav
  • 1,891
  • 1
  • 17
  • 20
  • 8
    Showing how to make a swap file was really useful. – simotek Jul 16 '14 at 01:45
  • Also worth to mention that in order to persist those changes across reboots, you have to add `/mnt/10GB.swap none swap sw 0 0` line to `/etc/fstab`. – Alex Lipov Apr 17 '16 at 14:20
  • 1
    I have 32GiB memory in my laptop and it still failed. Deepa's solution worked. By limiting the nmumber of simultaneous jobs the memory usage went down by the same factor. The compilation completed with -j 9 and when linking crashed, I just did -j 1 and it worked :) – Mr. Developerdude Feb 24 '17 at 02:54
7

I tried with make -j1 and it works!. But it takes long time to build.

Deepa
  • 81
  • 1
  • 1
3

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.

  • having configured without '--enable-optimized' I found that 2G wasn't enough. I had to bump my VM's memory up to 3G to build clang. – Peeter Joot Nov 20 '12 at 18:20
1

I would suggest using of -l (--max-load) option instead of limiting -j in this case. Possibly helpful answer.

KernelPanic
  • 101
  • 2
  • 7
  • The question is actual and the answer helps when others don't. I ran into a similar problem today and couldn't find solution among existing answers. – KernelPanic Sep 14 '18 at 17:21