<div dir="ltr">I just realized, as Reid pointed out, the code already does return -1 when we hit this situation (which should cause fall back to std::thread::hardware_concurrency). This was fixed in <a href="https://reviews.llvm.org/D32032">https://reviews.llvm.org/D32032</a> (r300267).<div><br></div><div>So you would be getting an error message, but it should still fall back to the right behavior. Is it just the existence of the printed message that is causing you grief? It looks like you are actually getting a non-zero exit code, how is that happening?</div><div><br></div><div>Teresa</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 11, 2017 at 1:05 PM, Miller Henry <span dir="ltr"><<a href="mailto:MillerHenry@johndeere.com" target="_blank">MillerHenry@johndeere.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div class="m_2720386292631493552WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Looks like consensus is this is a bug not intended behavior so I wrote up bug 33008 on it.  Thanks for the feedback.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><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"> Teresa Johnson [mailto:<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>]
<br>
<b>Sent:</b> Wednesday, May 10, 2017 6:56 PM<br>
<b>To:</b> Reid Kleckner <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>><br>
<b>Cc:</b> Miller Henry <MillerHenry@JohnDeere.com>; <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><span class=""><br>
<b>Subject:</b> Re: [cfe-dev] icecream - what should /proc/cpuinfo contain on remote machines?<u></u><u></u></span></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Wed, May 10, 2017 at 1:01 PM, Reid Kleckner <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>> wrote:<u></u><u></u></p><div><div class="h5">
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">This seems like an LLVM bug. I'd rather LLVM didn't look in /proc, but I can't find an alternative. In any case, we shouldn't print to stderr for a successful build. Silently falling back to std::thread::hardware_<wbr>concurrency() seems fine,
 which is what the code does.<u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Agreed, we should at least return -1 if we can't find /proc/cpuinfo (which will result in fallback to std::thread::hardware_<wbr>concurrency()). The question I have is whether it should be silent or not - my understanding was that this file
 should exist in x86_64 Linux.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">But I am also wondering how you hit this, since reading through the github thread you linked indicated that this is not LTO or ThinLTO. Oh, I see now where it is being used to initialize the value of an option...if this is a file that will
 not always exist for Linux x86_64 then it needs to fall back silently.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Teresa<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></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">
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<div>
<p class="MsoNormal">On Wed, May 10, 2017 at 12:21 PM, Miller Henry via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p>
</div>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Greetings, I’m the maintainer of icecream, and I’m trying to solve a bug some of my users are seeing: when using clang  4.0 their build fails because the file /proc/cpuinfo
 does not exist.  I’m trying to figure out what the right solution to this is. See
<a href="https://github.com/icecc/icecream/issues/176" target="_blank"><span style="color:#0563c1">https://github.com/icecc/<wbr>icecream/issues/176</span></a>
<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From what we can tell this came in from:
<a href="https://reviews.llvm.org/D25564" target="_blank"><span style="color:#0563c1">https://reviews.llvm.org/<wbr>D25564</span></a>. 
<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">A summary for those who don’t want to read the above: icecream is a distributed build tool that allows you to use other networked computers to speed up your builds.  The local
 build machine where you run “make” ships the compiler to remote machines which then run the compiler in a chroot (this ensures that if the remote has a different version of clang installed we do not use that).<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">We see three options:<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Place an empty /proc/cpuinfo in the chroot. This seems to work and it is easy.  From what we can tell this file is only used at link time and icecream does not link on remote
 machines.  However if clang starts to use /proc/cpuinfo for something else (asserts on valid contents) we are broke again.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">When building the compiler package add /proc/cpuinfo from whatever machine is building the environment.  /proc/cpuinfo may be bogus but at least it exists. This is easy to
 do, but it is a coincidence if the file is actually correct.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Copy /proc/cpuinfo into the chroot on each build machine.  This is the most difficult to implement (test), and I’m not sure if it gains anything or not. Note in particular
 that icecream tries hard to use as many cores on the remote machines as possible without the user of the remote machine noticing a performance problem, thus clang using /proc/cpuinfo to spawn additional threads is probably something we do not want.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">I’m leaning to the first because it is easy, but others have different opinions. After looking at all the responses I’ve concluded that so far nobody actually knows enough
 about what clang is doing (much less planning to do) to make a useful decision.  Thus I’m reaching out to the clang community: what considerations are we not aware of, and is there a good reason to choose any plan?<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</blockquote>
</div></div></div><div><div class="h5">
<p class="MsoNormal"><br>
<br clear="all">
<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">-- <u></u><u></u></p>
<div>
<table class="m_2720386292631493552MsoNormalTable" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td nowrap style="border:none;border-top:solid #d50f25 1.5pt;padding:0in 0in 0in 0in">
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#555555">Teresa Johnson |<u></u><u></u></span></p>
</td>
<td nowrap style="border:none;border-top:solid #3369e8 1.5pt;padding:0in 0in 0in 0in">
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#555555"> Software Engineer |<u></u><u></u></span></p>
</td>
<td nowrap style="border:none;border-top:solid #009939 1.5pt;padding:0in 0in 0in 0in">
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#555555"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |<u></u><u></u></span></p>
</td>
<td nowrap style="border:none;border-top:solid #eeb211 1.5pt;padding:0in 0in 0in 0in">
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#555555"> <a href="tel:(408)%20460-2413" value="+14084602413" target="_blank">408-460-2413</a><u></u><u></u></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div>
</div>
</div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Teresa Johnson |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> 408-460-2413</td></tr></tbody></table></span></div>
</div>