LLVM Discussion Forums

Unable to build on Ubuntu or Fedora

This may be the wrong category (admins please categorise as appropriate).

New to LLVM, I am unable to compile from source from git:

git clone https://github.com/llvm/llvm-project.git

On a pristine Fedora 32 installation it takes longer to build that anything I have ever seen - more than a day, consumes memory up to the maximum, gets to about 60% done and just hangs the (virtual) machine.

On Ubuntu 20, also consistently fails at this point:

[ 66%] Linking CXX shared library …/…/lib/libLTO.so
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
make[2]: *** [tools/lto/CMakeFiles/LTO.dir/build.make:250: lib/libLTO.so.11git] Error 1
make[2]: *** Deleting file ‘lib/libLTO.so.11git’
make[1]: *** [CMakeFiles/Makefile2:27926: tools/lto/CMakeFiles/LTO.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

I am unable to build. I do not at this stage know whether these are known or unknown defects, or simply my ignorance. I use make for cmake as ninja just wedged my systems coimpletely.

This is the typical symptoms of the linker being killed by the kernel when it runs out of memory.
You can:

  1. Use lld (or gold) as a linker instead of the gnu linker (-DLLVM_ENABLE_LLD=ON)
  2. build without debug info: this is very memory intensive for the linker
  3. reduce the parallelism of the build. If you switch to ninja instead of make you can pass -D LLVM_PARALLEL_LINK_JOBS=1 to limit only the number of linker jobs and not constraint the compile jobs.
1 Like

Normally Discourse forums deprecate posts just saying thanks, but in this instance I am so far unable to find a way to send a message to a user (whereas I can on many other Discourse sites). So I just want to say for reference by others who may have this issue is that the suggestions given are a brilliant success. Thanks!

I suspect our instance of Discourse want users to be first active to some extent before getting more “privileges” (like direct messaging). I think thanks post are just fine :wink: