<div dir="ltr">Simon, does a clean checkout of HEAD, with a default mk/<a href="http://build.mk">build.mk</a> (i.e. no funny linking options), lead to this failure for you?</div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Wed, Jul 16, 2014 at 2:48 PM, Niklas Larsson <span dir="ltr"><<a href="mailto:metaniklas@gmail.com" target="_blank">metaniklas@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div>
<div>
<div style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif">I have built ghc on windows after that was added with no issue.<br><br>I can take a look this evening and  see how HEAD works for me.<br><br>The standard gcc in the tarballs is 4.6.3, which is getting long in the tooth, there is an issue on trac to upgrade it. <br>

<br>-- Niklas<br><br></div></div>
<div dir="ltr">
<hr>
<span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif;FONT-WEIGHT:bold">Från: </span><span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif"><a href="mailto:johan.tibell@gmail.com" target="_blank">Johan Tibell</a></span><br>

<span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif;FONT-WEIGHT:bold">Skickat: </span><span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif">‎2014-‎07-‎16 09:57</span><br><span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif;FONT-WEIGHT:bold">Till: </span><span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif"><a href="mailto:simonpj@microsoft.com" target="_blank">Simon Peyton Jones</a></span><br>

<span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif;FONT-WEIGHT:bold">Kopia: </span><span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif"><a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a></span><br>

<span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif;FONT-WEIGHT:bold">Ämne: </span><span style="FONT-SIZE:11pt;FONT-FAMILY:Calibri,sans-serif">Re: Windows breakage -- again</span><br><br></div><div><div class="h5">


<div dir="ltr">You can rollback the commit (git revert <span style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">4ee4ab01c1d97845aecb7707ad2f9a</span><span style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">80933e7a49) and push that to the repo if you wish. I will try to re-add the primop again after I figure out what's wrong.</span></div>


<div class="gmail_extra"><br><br>
<div class="gmail_quote">On Wed, Jul 16, 2014 at 9:37 AM, Johan Tibell <span dir="ltr"><<a href="mailto:johan.tibell@gmail.com" target="_blank">johan.tibell@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid">
<div dir="ltr">I added some primops about a month ago (4ee4ab01c1d97845aecb7707ad2f9a80933e7a49) that call __sync_fetch_and_add, a gcc/llvm builtin. I'm a bit surprised to see this error. The GCC manual [1] says: 
<div><br></div>
<div>> " Not all operations are supported by all target processors. If a particular operation cannot be implemented on the target processor, a warning will be generated and a call an external function will be generated. The external function will carry the same name as the builtin, with an additional suffix `_n' where n is the size of the data type."<br>

</div>
<div><br></div>
<div>I'm a bit surprised by this error for two reasons:</div>
<div><br></div>
<div> * A call to that symbol should only be generated if the CPU doesn't support the atomic instructions. What CPU model does Windows report that you have?</div>
<div><br></div>
<div> * gcc should define such a symbol. For me the following test program compiles:</div>
<div><br></div>
<div>
<div>#include <stdint.h></div>
<div><br></div>
<div>uint8_t test(uint8_t* ptr, uint8_t val) {</div>
<div>  return __sync_fetch_and_add_1(ptr, val);</div>
<div>}</div>
<div><br></div>
<div>int main(void) {</div>
<div>  uint8_t n;</div>
<div>  return test(&n, 1);</div>
<div>}</div></div>
<div><br></div>
<div>Does that compile for you? Which version of GCC do we end up using on Windows?</div>
<div><br></div>
<div>The reported symbol (<span style="FONT-SIZE:13px;FONT-FAMILY:arial,sans-serif">___sync_fetch_and_add_1) has three leading underscores, that looks weird. Can you compile just libraries/ghc-prim/cbits/atomic.c and see if it's indeed GCC that generates a reference to that symbol?</span></div>


<div><br></div>
<div>
<div>1. <a href="http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html" target="_blank">http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html</a></div></div></div>
<div class="gmail_extra"><br><br>
<div class="gmail_quote">
<div>
<div>On Wed, Jul 16, 2014 at 12:29 AM, Simon Peyton Jones <span dir="ltr"><<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>></span> wrote:<br></div></div>
<blockquote class="gmail_quote" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid">
<div>
<div>
<div lang="EN-GB" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal">Aargh!  The Windows build has broken – again.  I can’t build GHC on my laptop any more.  <u></u><u></u></p>
<p class="MsoNormal">A clean ‘sh validate’ finishes as below.  What on earth is `___sync_fetch_and_add_1'?<u></u><u></u></p>
<p class="MsoNormal">Can anyone help?  Thanks!<u></u><u></u></p>
<p class="MsoNormal">Simon<u></u><u></u></p>
<p>"inplace/bin/ghc-stage2.exe" -hisuf hi -osuf  o -hcsuf hc -static  -H32m -O -Werror -Wall -H64m -O0    -package-name vector-0.10.9.1 -hide-all-packages -i -ilibraries/vector/. -ilibraries/vector/dist-install/build -ilibraries/vector/dist-install/build/autogen -Ilibraries/vector/dist-install/build -Ilibraries/vector/dist-install/build/autogen -Ilibraries/vector/include -Ilibraries/vector/internal   -optP-DVECTOR_BOUNDS_CHECKS -optP-include -optPlibraries/vector/dist-install/build/autogen/cabal_macros.h -package base-4.7.1.0 -package deepseq-1.3.0.2 -package ghc-prim-0.3.1.0 -package primitive-0.5.2.1 -O2 -XHaskell98 -XCPP -XDeriveDataTypeable -O2 -O -dcore-lint -fno-warn-deprecated-flags  -no-user-package-db -rtsopts -Wwarn     -odir libraries/vector/dist-install/build -hidir libraries/vector/dist-install/build -stubdir libraries/vector/dist-install/build   -c libraries/vector/./Data/Vector/Fusion/Stream/Monadic.hs -o libraries/vector/dist-install/build/Data/Vector/Fusion/Stream/Monadic.o <u></u><u></u></p>


<p>Loading package ghc-prim ... linking ... ghc-stage2.exe: unable to load package `ghc-prim'<u></u><u></u></p>
<p>ghc-stage2.exe: C:\code\HEAD\libraries\ghc-prim\dist-install\build\HSghc-prim-0.3.1.0.o: unknown symbol `___sync_fetch_and_add_1'<u></u><u></u></p>
<p>libraries/vector/<a href="http://ghc.mk:5" target="_blank">ghc.mk:5</a>: recipe for target 'libraries/vector/dist-install/build/Data/Vector/Fusion/Stream/Monadic.o' failed<u></u><u></u></p>
<p>make[1]: *** [libraries/vector/dist-install/build/Data/Vector/Fusion/Stream/Monadic.o] Error 1<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I<u></u><u></u></p></div></div><br></div></div>_______________________________________________<br>ghc-devs mailing list<br><a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>

<a href="http://www.haskell.org/mailman/listinfo/ghc-devs" target="_blank">http://www.haskell.org/mailman/listinfo/ghc-devs</a><br><br></blockquote></div><br></div></blockquote></div><br></div></div></div></div></blockquote>

</div><br></div>