[cfe-dev] Building clang

Dimitry Andric via cfe-dev cfe-dev at lists.llvm.org
Sat Aug 15 04:14:47 PDT 2020


On 15 Aug 2020, at 12:28, denis gantsev via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> I wanted to play with clang, and was trying to build it according to instructions (https://clang.llvm.org/get_started.html), with GCC 5.5 and GNU ld 2.26.1, running my linux 5.6.7.
> 
> However, the build regularly fails, running out of memory (my laptop has 12Gb RAM). I tried with both "Unix Makefiles" and "Ninja 1.7.1". I did specify explicitly "DLLVM_ENABLE_PROJECTS=clang".
> 
> Is it expected to consume that much memory during build?

What usually helps a lot is to add the following to your initial CMake invocation:

-D LLVM_PARALLEL_LINK_JOBS=1

Since linking tends to use lots of memory, and is rather slow, these jobs usually end up clustered together near the end of build stages, and will then fill up all available memory. Limiting the number of parallel link jobs usually helps with this problem.

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 223 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200815/dcb18997/attachment.sig>


More information about the cfe-dev mailing list