<div dir="ltr">And the truly final word for the moment : ) —<div>I built a tool to partially automate the indentation workaround for LLVM 3.0 and it yields the same &quot;co-processor offset out of range&quot;/&quot;unsupported relocation on symbol LCPI65_0&quot; errors LLVM 3.3/3.4 did when it finally gets to integer-simple/GHC/Integer/Type.hs.</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Aug 11, 2013 at 3:06 AM, Luke Iannini <span dir="ltr">&lt;<a href="mailto:lukexipd@gmail.com" target="_blank">lukexipd@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">OK! So just to summarize:<div>Building GHC HEAD with LLVM 3.0 or 3.2 (using GHC 7.6.3 as the bootstrap) on OS X 10.9 DP5/Xcode 5 DP5 exhibits very strange behavior wherein layout-based code along with mixed-tabs-and-spaces code fails to parse correctly, with issues in hundreds of files in the GHC HEAD tree.</div>


<div>I don&#39;t have a 10.8 machine to check if this is a 10.9 exclusive issue, so I&#39;d love if someone can try using these binaries to build GHC HEAD: <a href="http://llvm.org/releases/3.0/clang+llvm-3.0-x86_64-apple-darwin11.tar.gz" target="_blank">http://llvm.org/releases/3.0/clang+llvm-3.0-x86_64-apple-darwin11.tar.gz</a></div>


<div><br></div><div>Building GHC HEAD with LLVM 3.3 or 3.4 works great as a regular compiler with the 10.9 workarounds I outlined in another thread, but fails when compiling as a cross-compiler (./configure --target=arm-apple-darwin10) with these errors: </div>


<div><a href="https://gist.github.com/lukexi/2b129f34fa027172c5ee" target="_blank">https://gist.github.com/lukexi/2b129f34fa027172c5ee</a></div><div><br></div><div>So I&#39;m between a rock and a hard place at the moment.</div>

<div><br></div>
<div>The only (very tedious and slow) workaround I&#39;ve found for the 3.0/3.2 bug is to manually expand tabs to spaces, and to transform</div><div><font face="courier new, monospace">do x</font></div><div><font face="courier new, monospace">   y</font></div>


<div><font face="arial, helvetica, sans-serif">into</font></div><div><font face="courier new, monospace">do</font></div><div><font face="courier new, monospace">    x</font></div><div><font face="courier new, monospace">    y</font></div>


<div><font face="arial, helvetica, sans-serif">(similarly for where and let blocks)</font></div><div><br></div><div>Cheers</div><span class="HOEnZb"><font color="#888888"><div>Luke</div></font></span></div><div class="HOEnZb">

<div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Aug 11, 2013 at 1:53 AM, Luke Iannini <span dir="ltr">&lt;<a href="mailto:lukexipd@gmail.com" target="_blank">lukexipd@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Argh, sorry for the confusion: 3.2 *does* exhibit the issue. 3.3 and 3.4 do not.</div><div>
<div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Aug 11, 2013 at 1:39 AM, Luke Iannini <span dir="ltr">&lt;<a href="mailto:lukexipd@gmail.com" target="_blank">lukexipd@gmail.com</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Further investigation:<div><br></div><div>I grabbed 7.6.3 just to see if I somehow had a bad install of GHC, but the problem still occurred.</div>



<div><br></div><div>The problem only occurs with LLVM 3.0. </div>
<div><br></div><div>It is not related to cross-compilation or Stephen&#39;s patches: I tested this on multiple fresh clones with --with-gcc=clang.<br></div><div><br></div><div>LLVM 3.2, 3.3 and 3.4 do not exhibit the issue.</div>




<div><br></div><div>If anyone wants to try to reproduce, you can grab the LLVM 3.0 binaries here <a href="http://llvm.org/releases/3.0/clang+llvm-3.0-x86_64-apple-darwin11.tar.gz" target="_blank">Clang Binaries for MacOS X/x86-64</a> and just drop them in your path.</div>




<div><br></div><div>(Stephen, I&#39;m now trying your patch with LLVM 3.2)</div><div><br></div><div>Cheers</div><span><font color="#888888"><div>Luke</div></font></span></div><div><div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 10, 2013 at 8:11 PM, Luke Iannini <span dir="ltr">&lt;<a href="mailto:lukexipd@gmail.com" target="_blank">lukexipd@gmail.com</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The first error on a fresh checkout is<div><p style="margin:0px;font-size:11px;font-family:Menlo">&quot;/usr/local/bin/ghc&quot; -hisuf hi -osuf  o -hcsuf hc -static  -H32m -O  -package-db libraries/bootstrapping.conf  -hide-all-packages -i -iutils/hsc2hs/. -iutils/hsc2hs/dist/build -iutils/hsc2hs/dist/build/autogen -Iutils/hsc2hs/dist/build -Iutils/hsc2hs/dist/build/autogen     -optP-include -optPutils/hsc2hs/dist/build/autogen/cabal_macros.h -package base-4.6.0.1 -package containers-0.5.0.0 -package directory-1.2.0.1 -package filepath-1.3.0.1 -package process-1.1.0.2 -XHaskell98 -XCPP -XForeignFunctionInterface  -no-user-package-db -rtsopts      -odir utils/hsc2hs/dist/build -hidir utils/hsc2hs/dist/build -stubdir utils/hsc2hs/dist/build   -c utils/hsc2hs/./C.hs -o utils/hsc2hs/dist/build/C.o </p>







<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">utils/hsc2hs/C.hs:155:3:</p><div>
<p style="margin:0px;font-size:11px;font-family:Menlo">    parse error (possibly incorrect indentation or mismatched brackets)</p><p style="margin:0px;font-size:11px;font-family:Menlo"><br></p></div><p style="margin:0px">




There seem to be two classes of error: one is the layout issue above, but other files can be fixed by simply running &#39;expand&#39; on them.</p>
</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 10, 2013 at 6:42 PM, Luke Iannini <span dir="ltr">&lt;<a href="mailto:lukexipd@gmail.com" target="_blank">lukexipd@gmail.com</a>&gt;</span> wrote:<br>





<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Stephen/all,<div><br></div><div>I got LLVM 3.0 installed and started building again but hit a very strange problem now wherein tons of layout-based code (as in <a href="http://en.wikibooks.org/wiki/Haskell/Indentation" target="_blank">http://en.wikibooks.org/wiki/Haskell/Indentation</a>) is suddenly erroring out, e.g.</div>






<div><div>compiler/coreSyn/CoreUnfold.lhs:481:2:</div><div>    parse error (possibly incorrect indentation or mismatched brackets)</div></div><div>(some files also seem to be triggered by mixed tabs and spaces)</div><div>






<br></div><div>I can fix the errors one by one by converting the code to use more concrete indentation (like</div><div>do</div><div>    thing1</div><div>    thing2</div><div>)</div><div>but it&#39;s all over the tree. </div>






<div><br></div><div>Anyone have any idea what might cause this?</div><div><br></div><div>Cheers</div><span><font color="#888888"><div>Luke</div></font></span></div><div><div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Aug 9, 2013 at 6:14 AM, Stephen Blackheath [to GHC-iPhone] <span dir="ltr">&lt;<a href="mailto:likeliest.complexions.stephen@blacksapphire.com" target="_blank">likeliest.complexions.stephen@blacksapphire.com</a>&gt;</span> wrote:<br>






<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Luke,<br>
<br>
Try llvm version 3.0 - that&#39;s what I&#39;m using, and it definitely worked before. llvm-3.1 is broken for GHC+ARM. As for llvm &gt;= 3.2, I&#39;m not sure if it&#39;s been fixed yet, but it wasn&#39;t working last time I tried a couple of months ago. I think this was because llvm is getting fussier about its input and GHC hasn&#39;t been &quot;tightened up&quot; yet.<br>







<br>
It&#39;s really easy to build llvm from source.<br>
<br>
<br>
Steve<div><br>
<br>
On 09/08/13 20:35, Luke Iannini wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
v3 output: <a href="https://gist.github.com/lukexi/7ca55b36269703236f1f" target="_blank">https://gist.github.com/<u></u>lukexi/7ca55b36269703236f1f</a><br>
<br>
<br>
On Fri, Aug 9, 2013 at 4:34 AM, Luke Iannini &lt;<a href="mailto:lukexipd@gmail.com" target="_blank">lukexipd@gmail.com</a><br></div><div>
&lt;mailto:<a href="mailto:lukexipd@gmail.com" target="_blank">lukexipd@gmail.com</a>&gt;&gt; wrote:<br>
<br>
    OK, that got me past that one.<br>
<br>
    Now I&#39;m stuck here during compilation of integer-simple:<br>
    <a href="https://gist.github.com/lukexi/d9f8bfd8bca56d5d0ee9" target="_blank">https://gist.github.com/<u></u>lukexi/d9f8bfd8bca56d5d0ee9</a><br>
<br>
    (&quot;unsupported relocation on symbol&quot;/&quot;co-processor offset out of range&quot;)<br>
<br>
<br>
    On Fri, Aug 9, 2013 at 4:00 AM, Luke Iannini &lt;<a href="mailto:lukexipd@gmail.com" target="_blank">lukexipd@gmail.com</a><br></div><div>
    &lt;mailto:<a href="mailto:lukexipd@gmail.com" target="_blank">lukexipd@gmail.com</a>&gt;&gt; wrote:<br>
<br>
        OK, I&#39;m underway on this.<br>
<br>
        First roadbump was:<br>
<br>
<br>
        &quot;inplace/bin/ghc-stage1&quot; -static -H32m -O -Iincludes<br>
        -Iincludes/dist -Iincludes/dist-<u></u>derivedconstants/header<br>
        -Iincludes/dist-ghcconstants/<u></u>header -Irts -Irts/dist/build<br>
        -DCOMPILING_RTS -package-name rts -dcmm-lint -i -irts<br>
        -irts/dist/build -irts/dist/build/autogen -Irts/dist/build<br>
        -Irts/dist/build/autogen -O2 -c rts/Apply.cmm -o<br>
        rts/dist/build/Apply.o<br>
<br>
<br>
<br>
<br>
        You are using a new version of LLVM that hasn&#39;t been tested yet!<br>
        We will try though...<br>
        /usr/local/bin/llc: : error: unable to get target for<br>
        &#39;arm-apple-darwin10&#39;, see --version and --triple.<br>
<br>
<br>
        which I figured out were because the homebrew LLVM 3.4 only<br>
        includes host platforms by default (x86/x86-64)<br>
        Reinstalling it with all-targets enables them all:<br>
        brew install llvm --with-clang --all-targets --HEAD<br>
<br>
        Trying again now.<br>
<br>
<br>
<br>
<br>
        On Thu, Aug 8, 2013 at 5:29 PM, Luke Iannini &lt;<a href="mailto:lukexipd@gmail.com" target="_blank">lukexipd@gmail.com</a><br></div><div>
        &lt;mailto:<a href="mailto:lukexipd@gmail.com" target="_blank">lukexipd@gmail.com</a>&gt;&gt; wrote:<br>
<br>
            Update: I&#39;ve got GHC HEAD building on 10.9 again, tonight<br>
            I&#39;ll dive into the iOS patch!<br>
            Cheers<br>
            Luke<br>
<br>
<br>
            On Wed, Aug 7, 2013 at 9:12 PM, Carter Schonwald<br>
            &lt;<a href="mailto:carter.schonwald@gmail.com" target="_blank">carter.schonwald@gmail.com</a><br></div><div>
            &lt;mailto:<a href="mailto:carter.schonwald@gmail.com" target="_blank">carter.schonwald@<u></u>gmail.com</a>&gt;&gt; wrote:<br>
<br>
                if you&#39;re on 10.8, just DL the 4.6 CLI tools to get<br>
                things working again.<br>
<br>
                If you&#39;re on 10.9, you&#39;ll need to use recent GHC head +<br>
                CLANG HEAD, (ok, the most recent XCODE 5 dev preview CLI<br>
                tools may have all the needed clang patches, but thats<br>
                still needing its own validation, orthogonal to the IOS<br>
                related issues )<br>
<br>
<br>
                On Tue, Aug 6, 2013 at 7:06 PM, Luke Iannini<br></div><div>
                &lt;<a href="mailto:lukexipd@gmail.com" target="_blank">lukexipd@gmail.com</a> &lt;mailto:<a href="mailto:lukexipd@gmail.com" target="_blank">lukexipd@gmail.com</a>&gt;&gt; wrote:<br>
<br>
                    Hi Stephen,<br>
<br>
                    I installed 10.9 for another project and thus am in<br>
                    the middle of fixing up my system to be able to<br>
                    build GHC again, but I think I&#39;m close — as soon as<br>
                    I have it going I&#39;ll try this.<br>
<br>
                    In the meantime someone still on 10.8 should<br>
                    definitely try the patch!<br>
<br>
                    Hope you&#39;re great!<br>
                    Luke<br>
<br>
<br>
                    On Tue, Aug 6, 2013 at 6:42 PM, Stephen Blackheath<br>
                    [to GHC-iPhone]<br>
                    &lt;<a href="mailto:likeliest.complexions.stephen@blacksapphire.com" target="_blank">likeliest.complexions.<u></u>stephen@blacksapphire.com</a><br></div>
                    &lt;mailto:<a href="mailto:likeliest.complexions.stephen@blacksapphire.com" target="_blank">likeliest.complexions.<u></u>stephen@blacksapphire.com</a>&gt;&gt;<div><br>
                    wrote:<br>
<br>
                        Hi all,<br>
<br>
                        A couple of months ago I got some patches<br>
                        applied to GHC mainline for the ability to cross<br>
                        compile to iOS. I&#39;ve been doing other things and<br>
                        now I want to test those changes. The trouble<br>
                        is, I am having Apple trouble and I can&#39;t get<br>
                        Xcode to work.<br>
<br>
                        If anyone is interested in testing it for me,<br>
                        I&#39;d appreciate it.<br>
<br>
                        The patch attached here needs to be applied to<br>
                        GHC head. Using this, I was able to get the<br>
                        cross compiler to build. The instructions are here:<br>
<br></div>
                        <a href="http://ghc.haskell.org/trac/__ghc/wiki/Building/__CrossCompiling/iOS" target="_blank">http://ghc.haskell.org/trac/__<u></u>ghc/wiki/Building/__<u></u>CrossCompiling/iOS</a><div>
<br>
                        &lt;<a href="http://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling/iOS" target="_blank">http://ghc.haskell.org/trac/<u></u>ghc/wiki/Building/<u></u>CrossCompiling/iOS</a>&gt;<br>
<br>
<br>
                        Steve<br>
<br>
                        ______________________________<u></u>_________________<br>
                        iPhone mailing list<br></div>
                        <a href="mailto:iPhone@haskell.org" target="_blank">iPhone@haskell.org</a> &lt;mailto:<a href="mailto:iPhone@haskell.org" target="_blank">iPhone@haskell.org</a>&gt;<div><br>
                        <a href="http://www.haskell.org/mailman/listinfo/iphone" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/iphone</a><br>
<br>
<br>
<br>
                    ______________________________<u></u>_________________<br>
                    iPhone mailing list<br></div>
                    <a href="mailto:iPhone@haskell.org" target="_blank">iPhone@haskell.org</a> &lt;mailto:<a href="mailto:iPhone@haskell.org" target="_blank">iPhone@haskell.org</a>&gt;<br>
                    <a href="http://www.haskell.org/mailman/listinfo/iphone" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/iphone</a><br>
<br>
<br>
<br>
<br>
<br>
<br>
</blockquote>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>