<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.pre
        {mso-style-name:pre;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">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. 
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">However, if you use “gold” or “LLD” instead, it works fine.  Assuming you have LLD, you can do:<o:p></o:p></span></p>
<p class="MsoNormal"><span class="pre"><span style="font-size:10.0pt;font-family:"Courier New"">-DLLVM_USE_LINKER=lld or –DLLVM_ENABLE_LLD=ON<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="pre"><span style="font-size:10.0pt;font-family:"Courier New""><o:p> </o:p></span></span></p>
<p class="MsoNormal"><span class="pre"><span style="font-size:10.0pt;font-family:"Courier New"">Otherwise you should have gold available, which you can do with:<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="pre"><span style="font-size:10.0pt;font-family:"Courier New"">-DLLVM_USE_LINKER=gold<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="pre"><span style="font-size:10.0pt;font-family:"Courier New""><o:p> </o:p></span></span></p>
<p class="MsoNormal"><span class="pre"><span style="font-size:10.0pt;font-family:"Courier New"">I can only run about 3-4 links at a time with LD and can do –j30 with no problems with Gold.</span></span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></a></p>
<p class="MsoNormal"><a name="_____replyseparator"></a><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> cfe-dev [mailto:cfe-dev-bounces@lists.llvm.org]
<b>On Behalf Of </b>James Courtier-Dutton via cfe-dev<br>
<b>Sent:</b> Thursday, June 20, 2019 3:27 AM<br>
<b>To:</b> nick <xerofoify@gmail.com><br>
<b>Cc:</b> cfe-dev@lists.llvm.org Developers <cfe-dev@lists.llvm.org><br>
<b>Subject:</b> Re: [cfe-dev] Out of Memory Building Clang and LLVM<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Wed, 19 Jun 2019 at 23:36, nick via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal" style="margin-bottom:12.0pt">Greetings, <br>
<br>
Seems I'm running out of memory on a host system trying to build llvm, tooling and clang. It was configured<br>
as:<br>
cmake -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../llvm<br>
<br>
and build with:<br>
<br>
make -j4 using gcc as the host compiler, version 8.<br>
<br>
The dmesg I'm getting is related to the linker and not sure if the linker has a bug or it's normal<br>
to expect 3GB or more used for linking clang. Doesn't seem to be but not sure.<br>
<br>
dmesg output:<br>
[186517.023397] Out of memory: Kill process 2143 (ld) score 286 or sacrifice child<br>
[186517.023403] Killed process 2143 (ld) total-vm:4622188kB, anon-rss:3202188kB, file-rss:4kB, shmem-rss:0kB<br>
<br>
<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">HI,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I have a 16 Core/32 Thread system with 32GB RAM, and it can have difficulty building CLANG/LLVM.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The link stage definitely needs to be with make -j1.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">That being said, if you force a "Release" version, and not the "Debug" version, much less RAM is needed.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Kind Regards<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">James<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>