Howto build optimized with stack traces/9.2.3 build broken?

Benjamin Maurer maurer.benjamin at gmail.com
Sun Jul 3 18:02:12 UTC 2022


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?
I heard GHC 9.2.2 is a broken release, or does anyone know whether it works
on Linux x86_64 (and comes with profiling libs from ghcup) - maybe I can
get a working version using that?

I'd try, but creating a new build takes almost an hour and I have spent
most of the day trying to solve this. I am puzzled and desearate to fix my
bug and get a working compiler.

Appreciate any help!

Best Regards,
Benjamin


[1]
https://gitlab.haskell.org/ghc/ghc/-/blob/master/hadrian/doc/debugging.md
[2] https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/296
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20220703/3bda9732/attachment.html>


More information about the ghc-devs mailing list