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

Keane, Erich via cfe-dev cfe-dev at lists.llvm.org
Thu Jun 20 05:56:57 PDT 2019


Clang definitely hits a pathological case in LD that makes it do terrible things if you use use more than a process or two in DEBUG.

However, if you use “gold” or “LLD” instead, it works fine.  Assuming you have LLD, you can do:
-DLLVM_USE_LINKER=lld or –DLLVM_ENABLE_LLD=ON

Otherwise you should have gold available, which you can do with:
-DLLVM_USE_LINKER=gold

I can only run about 3-4 links at a time with LD and can do –j30 with no problems with Gold.

From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of James Courtier-Dutton via cfe-dev
Sent: Thursday, June 20, 2019 3:27 AM
To: nick <xerofoify at gmail.com>
Cc: cfe-dev at lists.llvm.org Developers <cfe-dev at lists.llvm.org>
Subject: Re: [cfe-dev] Out of Memory Building Clang and LLVM



On Wed, 19 Jun 2019 at 23:36, nick via cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>> 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


HI,

I have a 16 Core/32 Thread system with 32GB RAM, and it can have difficulty building CLANG/LLVM.
The link stage definitely needs to be with make -j1.

That being said, if you force a "Release" version, and not the "Debug" version, much less RAM is needed.

Kind Regards

James


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190620/677f6325/attachment.html>


More information about the cfe-dev mailing list