Hey all,
I'm trying to debug a segfault caused by my optimization. GHC only segfaults when compiled with -O2 and my flag, i.e., I used the "perf" flavour:
> ./hadrian/build -j "stage1.*.ghc.hs.opts += -fregs-ssa" --flavour=perf
However, I can't get a stack trace.
[1] suggests I need a profiling build for that. So I tried:
> ./hadrian/build -j "stage1.*.ghc.hs.opts += -fregs-ssa" --flavour=perf+debug_info+profiled_ghc+no_dynamic_ghc
Unfortunately, I'm using GHC 9.2.1 from ghcup to bootstrap and this version doesn't come with profiling enabled base [2].
8.10.7, which I have installed, can't compile ghc anymore (it seems). So I tried 9.2.3 from ghcup and that gives me the strangest errors. Basically, the compiler seems completely bricked.
I installed 9.2.3, ran "hadrian/build clean", "./configure && ./boot" and the same line as above with both "default" and "perf" flavours.
When I try to compile nofib/spectral/simple, I get:
> /home/ben/Projekte/haskell/ghc/_build/stage1/bin/ghc -O2 Main.hs
> [1 of 2] Compiling Main ( Main.hs, Main.o )
> Main.hs:1125:1: error: lexical error (UTF-8 decoding error)
(Main.hs only has 1124 lines though, file was not modified, compiles fine with any other ghc version)
But most programs I tried give me:
> /home/ben/Projekte/haskell/ghc/_build/stage1/bin/ghc -O2 Main.hs
> ghc: Unable to commit 283468890112 bytes of memory
> ghc: Exiting. The system might be out of memory.
Oh kay. I got 16GB RAM, 10 gig available. GHC 9.2.3 works fine.
Is my flavour combination bad, or what is broken here?
Any other (better) way to get an optimized build with all the debugging aids I can get?