<div dir="ltr"><div>+ghc-devs</div><div><br></div>Hi Ray,<div><br></div><div>thanks for the feedback. ghc-stage1 is a native application, it is built using a host ghc and a mingw gcc bundled with the ghc distribution (in order to keep Windows builds more predictable). The thing is, the same builds (using make) that were stable on cygwin seem to be crashing on msys2, even though the (bundled) gcc used for the build is the same. It could be that msys2 is triggering a bug in ghc somehow, but it could be something going on in msys2 itself.</div><div><br></div><div>The tricky part is that the crashes are rare, one in thousands of ghc invocations within a make build, and I'm having trouble pinning one down to investigate. I'll try some basic tracing first, but ideas for something more sophisticated would be very helpful.</div><div><br></div><div>A PKGBUILD for ghc should be feasible, although the bootstrapping is a bit tricky (some Haskell tools need to be preinstalled). I'm not sure how useful it would be since for Windows there is already a nicely packaged native Haskell Platform installer.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 3, 2014 at 3:30 AM, Ray Donnelly <span dir="ltr"><<a href="mailto:mingw.android@gmail.com" target="_blank">mingw.android@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sun, Nov 2, 2014 at 11:45 PM, Gintautas Miliauskas<br>
<<a href="mailto:gintautas.miliauskas@gmail.com">gintautas.miliauskas@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
> I have been working on building GHC, the Glasgow Haskell Compiler, on<br>
> Windows using msys2 [1]. We have been having some strange trouble with ghc<br>
> segfaulting during the bootstrapping process (i.e., during make). The<br>
> crashes are not very hard to reproduce, but they are not predictable either.<br>
> This is almost certainly a bug in ghc itself and not with msys2 (although<br>
> the crashes do not seem to occur in other environments), but I've been<br>
> having some trouble pinning it down.<br>
><br>
<br>
</span>Hi Gintuatas,<br>
<br>
Great. I spotted that MSYS2 was the recommended env. for GHC on<br>
Windows, hopefully it will remain so!<br>
<div><div class="h5"><br>
> What's a good way to debug such crashes? Is it possible to somehow stop the<br>
> ghc process when it segfaults and attach gdb, or to dump core somehow for<br>
> later inspection?<br>
><br>
> [1] <a href="https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Windows" target="_blank">https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Windows</a><br>
><br>
> Here's one example crash:<br>
><br>
> "inplace/bin/ghc-stage1.exe" -hisuf hi -osuf  o -hcsuf hc -static  -H32m -O<br>
> -Werror -Wall -H64m -O0    -this-package-key ghc_4ugNArSu5ba0Z1uHXrbTlU<br>
> -hide-all-packages -i -icompiler/basicTypes -icompiler/cmm<br>
> -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci<br>
> -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main<br>
> -icompiler/nativeGen -icompiler/parser -icompiler/prelude<br>
> -icompiler/profiling -icompiler/rename -icompiler/simplCore<br>
> -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn<br>
> -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils<br>
> -icompiler/vectorise -icompiler/stage2/build -icompiler/stage2/build/autogen<br>
> -Icompiler/stage2/build -Icompiler/stage2/build/autogen -Icompiler/.<br>
> -Icompiler/parser -Icompiler/utils -Icompiler/../rts/dist/build<br>
> -Icompiler/stage2   -optP-DGHCI -optP-include<br>
> -optPcompiler/stage2/build/autogen/cabal_macros.h -package-key<br>
> Win32_43THQMouBnk2wpnouztX1X -package-key array_GX4NwjS8xZkC2ZPtjgwhnz<br>
> -package-key base_ESD4aQEEWwsHtYJVc1BwtJ -package-key<br>
> binpa_17GphrLqCXt1H1lm4Kse1p -package-key bytes_Kc0PyaputnzDnBdZW0y2Gv<br>
> -package-key conta_ChF4XLXB9JmByIycPzerow -package-key<br>
> direc_HU5aFxMIQNwGQFzisjuinu -package-key filep_34DFDFT9FVD9pRLLgh8IdQ<br>
> -package-key hoopl_IZAd44CED5NCOlpg8p2Kaj -package-key<br>
> hpc_1QTsfQSN40FHN9p3mydARY -package-key proce_7ZlAbRkwiRO8qgXx3NNP0G<br>
> -package-key templ_F6UJgDtBcDIFWuHmMGEFzy -package-key<br>
> time_HGs4JcQCd4wF6U8vJQ5fNH -package-key trans_5jw4w9yTgmZ89ByuixDAKP -Wall<br>
> -fno-warn-name-shadowing -this-package-key ghc -XHaskell2010<br>
> -optc-DTHREADED_RTS -DGHCI_TABLES_NEXT_TO_CODE -DSTAGE=2 -Rghc-timing -O2<br>
> -fwarn-tabs -O -dcore-lint  -no-user-package-db -rtsopts      -odir<br>
> compiler/stage2/build -hidir compiler/stage2/build -stubdir<br>
> compiler/stage2/build   -c compiler/basicTypes/UniqSupply.lhs -o<br>
> compiler/stage2/build/UniqSupply.o<br>
><br>
> compiler/<a href="http://ghc.mk:657" target="_blank">ghc.mk:657</a>: recipe for target 'compiler/stage2/build/UniqSupply.o'<br>
> failed<br>
> make[1]: *** [compiler/stage2/build/UniqSupply.o] Segmentation fault<br>
><br>
<br>
</div></div>Well, it's pretty much the same story as with Linux. Build the<br>
executable and as many libraries as you can with (something like)<br>
"-ggdb -O0" then use gdb command line or some IDE of choice.<br>
Personally I use Qt Creator (we have packages for this) as it can<br>
debug external programs and, even though I don't dislike command<br>
lines, I find debugging from them a bit too masochistic.<br>
<br>
Is ghc-stage1.exe an MSYS2 program or a native one? Which compiler is<br>
it built with exactly?<br>
<br>
What would be involved in creating a PKGBUILD for ghc? We'd love to<br>
have one, and it'd certainly make me a lot more inclined to dive in to<br>
see what's going on if one existed already.<br>
<span class="HOEnZb"><font color="#888888"><br>
Ray.<br>
<br>
><br>
> --<br>
> Gintautas Miliauskas<br>
><br>
> ------------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> Msys2-users mailing list<br>
> <a href="mailto:Msys2-users@lists.sourceforge.net">Msys2-users@lists.sourceforge.net</a><br>
> <a href="https://lists.sourceforge.net/lists/listinfo/msys2-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/msys2-users</a><br>
><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Gintautas Miliauskas</div>
</div>