On Sun, Nov 2, 2014 at 11:45 PM, Gintautas Miliauskas <[email protected]> wrote: > Hello, > > I have been working on building GHC, the Glasgow Haskell Compiler, on > Windows using msys2 [1]. We have been having some strange trouble with ghc > segfaulting during the bootstrapping process (i.e., during make). The > crashes are not very hard to reproduce, but they are not predictable either. > This is almost certainly a bug in ghc itself and not with msys2 (although > the crashes do not seem to occur in other environments), but I've been > having some trouble pinning it down. >
Hi Gintuatas, Great. I spotted that MSYS2 was the recommended env. for GHC on Windows, hopefully it will remain so! > What's a good way to debug such crashes? Is it possible to somehow stop the > ghc process when it segfaults and attach gdb, or to dump core somehow for > later inspection? > > [1] https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Windows > > Here's one example crash: > > "inplace/bin/ghc-stage1.exe" -hisuf hi -osuf o -hcsuf hc -static -H32m -O > -Werror -Wall -H64m -O0 -this-package-key ghc_4ugNArSu5ba0Z1uHXrbTlU > -hide-all-packages -i -icompiler/basicTypes -icompiler/cmm > -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci > -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main > -icompiler/nativeGen -icompiler/parser -icompiler/prelude > -icompiler/profiling -icompiler/rename -icompiler/simplCore > -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn > -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils > -icompiler/vectorise -icompiler/stage2/build -icompiler/stage2/build/autogen > -Icompiler/stage2/build -Icompiler/stage2/build/autogen -Icompiler/. > -Icompiler/parser -Icompiler/utils -Icompiler/../rts/dist/build > -Icompiler/stage2 -optP-DGHCI -optP-include > -optPcompiler/stage2/build/autogen/cabal_macros.h -package-key > Win32_43THQMouBnk2wpnouztX1X -package-key array_GX4NwjS8xZkC2ZPtjgwhnz > -package-key base_ESD4aQEEWwsHtYJVc1BwtJ -package-key > binpa_17GphrLqCXt1H1lm4Kse1p -package-key bytes_Kc0PyaputnzDnBdZW0y2Gv > -package-key conta_ChF4XLXB9JmByIycPzerow -package-key > direc_HU5aFxMIQNwGQFzisjuinu -package-key filep_34DFDFT9FVD9pRLLgh8IdQ > -package-key hoopl_IZAd44CED5NCOlpg8p2Kaj -package-key > hpc_1QTsfQSN40FHN9p3mydARY -package-key proce_7ZlAbRkwiRO8qgXx3NNP0G > -package-key templ_F6UJgDtBcDIFWuHmMGEFzy -package-key > time_HGs4JcQCd4wF6U8vJQ5fNH -package-key trans_5jw4w9yTgmZ89ByuixDAKP -Wall > -fno-warn-name-shadowing -this-package-key ghc -XHaskell2010 > -optc-DTHREADED_RTS -DGHCI_TABLES_NEXT_TO_CODE -DSTAGE=2 -Rghc-timing -O2 > -fwarn-tabs -O -dcore-lint -no-user-package-db -rtsopts -odir > compiler/stage2/build -hidir compiler/stage2/build -stubdir > compiler/stage2/build -c compiler/basicTypes/UniqSupply.lhs -o > compiler/stage2/build/UniqSupply.o > > compiler/ghc.mk:657: recipe for target 'compiler/stage2/build/UniqSupply.o' > failed > make[1]: *** [compiler/stage2/build/UniqSupply.o] Segmentation fault > Well, it's pretty much the same story as with Linux. Build the executable and as many libraries as you can with (something like) "-ggdb -O0" then use gdb command line or some IDE of choice. Personally I use Qt Creator (we have packages for this) as it can debug external programs and, even though I don't dislike command lines, I find debugging from them a bit too masochistic. Is ghc-stage1.exe an MSYS2 program or a native one? Which compiler is it built with exactly? What would be involved in creating a PKGBUILD for ghc? We'd love to have one, and it'd certainly make me a lot more inclined to dive in to see what's going on if one existed already. Ray. > > -- > Gintautas Miliauskas > > ------------------------------------------------------------------------------ > > _______________________________________________ > Msys2-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/msys2-users > ------------------------------------------------------------------------------ _______________________________________________ Msys2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/msys2-users
