[cfe-dev] Out of Memory Building Clang and LLVM

Brooks Davis via cfe-dev cfe-dev at lists.llvm.org
Wed Jun 19 15:44:18 PDT 2019


On Wed, Jun 19, 2019 at 06:36:33PM -0400, nick via cfe-dev wrote:
> Greetings, 
> 
> Seems I'm running out of memory on a host system trying to build llvm, tooling and clang. It was configured
> as:
> cmake -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../llvm
> 
> and build with:
> 
> make -j4 using gcc as the host compiler, version 8.
> 
> The dmesg I'm getting is related to the linker and not sure if the linker has a bug or it's normal
> to expect 3GB or more used for linking clang. Doesn't seem to be but not sure.
> 
> dmesg output:
> [186517.023397] Out of memory: Kill process 2143 (ld) score 286 or sacrifice child
> [186517.023403] Killed process 2143 (ld) total-vm:4622188kB, anon-rss:3202188kB, file-rss:4kB, shmem-rss:0kB

I can't comment on this particular configuration, but last I
heard it still builds in 3GB.  That said, you may want to include
-DLLVM_PARALLEL_LINK_JOBS=1 in your linker arguments.  At least with
ninja (not sure about make), there tend to be many programs being linked
at the end and on a low-memory system this can lead to out of memory
conditions.

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190619/43fd45c1/attachment.sig>


More information about the cfe-dev mailing list