I want to provide a stack trace from my Haskell program when an error occurs. I plan to use GHC.ExecutionStack
. The documentation says:
Your GHC must have been built with
libdw
support for this to work.user@host:~$ ghc --info | grep libdw
,(“RTS expects libdw”,YES)
Q1: I didn’t see libdw
in the NixOS package repo, but I did see libdwarf
. Is that the right library?
I added libdwarf
to my NixOS configuration and did nixos-rebuild switch --upgrade
, but that didn’t get me a GHC with libdw
support.
$ ghc --info | grep libdw
,("RTS expects libdw","NO")
Note: I’ve seen this issue about getting GHC with DWARF support into NixOS. A pull request was generated.
Q2: Is my best bet to create my own Nix derivation that builds an appropriate GHC? If so, can anyone point me to a similar Nix derivation that I can use as a guide? A derivation that builds GHC would be ideal, because I think I could figure out how to include libdw.
I was able to build a Debian-based docker image with GHC and libdw support, so I might fall back to using that if I can’t figure out how to do this the Nix way.