<div dir="ltr">It depends on if ninja is writing to a interactive terminal or no. If it's writing to an interactive terminal, it prints the "[N/M] building foobar" line when it starts running it, and then it prints it again followed by the subprocesses output when it's done running it (usually with a different value for N). If it's writing to a buildbot log, then it only prints the line when it's done running the command, followed by the command's output.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 20, 2018 at 1:32 PM <<a href="mailto:paul.robinson@sony.com">paul.robinson@sony.com</a>> wrote:<br></div><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_-7430391202976798229WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">So when ninja says "[N/M] Building foobar" that means it's actually *all done* building foobar.  Excellent.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Re. the double message, "blame Microsoft" as I'm not motivated to dig into it any further.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks for the info!  It did help.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--paulr<u></u><u></u></span></p>
<p class="MsoNormal"><a name="m_-7430391202976798229__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Nico Weber [mailto:<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>]
<br>
<b>Sent:</b> Tuesday, November 20, 2018 9:49 AM<br>
<b>To:</b> Robinson, Paul<br>
<b>Cc:</b> llvm-dev<br>
<b>Subject:</b> Re: [llvm-dev] Ninja build (on Windows anyway) may be doing redundant work<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Ninja makes subprocesses write to a pipe and prints their output preceded by the [N/M] line before printing their output the process is done, to not get interleaving output from parallel processes and to make it easy to see which process
 a given output belongs to. So link.exe definitely prints this line twice.<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Nov 20, 2018 at 9:28 AM <<a href="mailto:paul.robinson@sony.com" target="_blank">paul.robinson@sony.com</a>> wrote:<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>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">(resend to the list)</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">And of course, just as I say that, my next ninja build shows the line only once.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">On reflection I am less sure that the lack of a [N/M] line means they are from the same invocation.
 Surely ninja could spawn two links, which then independently report "Creating library" after ninja emits the [N/M] lines.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--paulr</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><a name="m_-7430391202976798229_m_5238897006417232255__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></a><u></u><u></u></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> llvm-dev [mailto:<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>]
<b>On Behalf Of </b>via llvm-dev<br>
<b>Sent:</b> Tuesday, November 20, 2018 9:01 AM<br>
<b>To:</b> <a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a><br>
<b>Cc:</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] Ninja build (on Windows anyway) may be doing redundant work</span><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">OK, worth knowing.  Thanks.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--paulr</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Nico Weber [mailto:<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>]
<br>
<b>Sent:</b> Monday, November 19, 2018 7:11 PM<br>
<b>To:</b> Robinson, Paul<br>
<b>Cc:</b> Zachary Turner; llvm-dev<br>
<b>Subject:</b> Re: [llvm-dev] Ninja build (on Windows anyway) may be doing redundant work</span><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Since there's no "[2663/3121] " line between the two messages, the two lines are from the same link.exe invocation. I don't know why link.exe thinks it needs to print this line
 twice, ninja doesn't have anything to do with it.<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">On Mon, Nov 19, 2018 at 6:57 PM <<a href="mailto:paul.robinson@sony.com" target="_blank">paul.robinson@sony.com</a>> wrote:<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-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I'm more concerned about seeing the message come out twice, which implies Ninja is executing a rule
 twice when it doesn't need to.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--paulr</span><u></u><u></u></p>
<p class="MsoNormal"><a name="m_-7430391202976798229_m_5238897006417232255_m_-792050111757344"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></a><u></u><u></u></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Nico Weber [mailto:<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>]
<br>
<b>Sent:</b> Monday, November 19, 2018 6:09 PM<br>
<b>To:</b> Zachary Turner<br>
<b>Cc:</b> Robinson, Paul; llvm-dev<br>
<b>Subject:</b> Re: [llvm-dev] Ninja build (on Windows anyway) may be doing redundant work</span><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">Do you still see this if you use lld-link for linking?<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">The "corrupt obj file" is something we saw on chrome's bots every now and then before we switched to lld.<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">On Mon, Nov 19, 2018 at 5:27 PM Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:<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-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><a href="mailto:thakis@google.com" id="m_-7430391202976798229m_5238897006417232255m_-7920501117573442540m_-7276686908134016340IloFPc-2" target="_blank">+Nico Weber</a> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">On Mon, Nov 19, 2018 at 12:25 PM via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<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-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal">This afternoon I did a clean build of llvm using ninja and MSVC 2015 on<br>
Windows 10. I saw something curious and wondered if any of the ninja or<br>
CMake experts out there can explain/fix it.<br>
<br>
[2663/3121] Linking CXX shared library bin\LTO.dll<br>
   Creating library lib\LTO.dll and object lib\LTO.exp<br>
   Creating library lib\LTO.dll and object lib\LTO.exp<br>
[3120/3121] Running the LLVM regression tests<br>
[[[ etc ]]]<br>
<br>
I'm curious about the "creating library" message popping out twice.<br>
Sometimes ninja builds will die on me, complaining about a corrupted<br>
object file, usually related to LTO. Rerunning ninja usually completes<br>
successfully.  So I wonder if there's some mishap in the dependencies<br>
somewhere that actually causes the build to try to link the DLL twice,<br>
which of course might corrupt a file if the links are overlapping in<br>
time.<br>
<br>
Thought I'd throw this out there in case someone wants to take a look.<br>
--paulr<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>

</blockquote></div>