<div dir="ltr">Hi All<br><br>I've noticed this is a quiet mailing list recently, but I couldn't find a more appropriate place to ask this question. Please say if there's somewhere else I should be asking.<br><br>It's my understanding that one can get GHC executables to dump backtraces of all their running threads to stderr upon receiving SIGQUIT. And the way to do that is to build with 'libdw' support.<div><br></div><div>We have a build system using Nix, and we're unfortunately a bit behind on GHC 9.2.2 atm, but in anycase, I noticed in a Nix develop shell when I run `ghc --info | grep libdw` I get:</div><div><br></div><div><span style="color:rgb(29,28,29);font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;font-variant-ligatures:none;background-color:rgba(29,28,29,0.04)">,("RTS expects libdw","NO")</span><br></div><div><br></div><div>So I instead added the following to my Haskell package overrides:<br></div><div><br></div><div><span style="color:rgb(29,28,29);font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;font-variant-ligatures:none;background-color:rgba(29,28,29,0.04)">ghc = 
  old.ghc.overrideAttrs (oldAttrs: {
    configureFlags = oldAttrs.configureFlags ++
      [
        "--with-libdw-includes=${<a href="http://pkgs.elfutils.dev">pkgs.elfutils.dev</a>}/include" 
        "--with-libdw-libraries=${pkgs.elfutils.out}/lib" 
        "--enable-dwarf-unwind"
      ];
    buildInputs = oldAttrs.buildInputs ++ [pkgs.elfutils];
  });</span><br></div><div><br></div><div>I basically copy/pastaed this from <a href="https://github.com/input-output-hk/haskell.nix/blob/master/compiler/ghc/default.nix">https://github.com/input-output-hk/haskell.nix/blob/master/compiler/ghc/default.nix</a><br><br>And this seems to work, now when I run `ghc --info` I get:<br><br><span style="color:rgb(29,28,29);font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;font-variant-ligatures:none;background-color:rgba(29,28,29,0.04)">,("RTS expects libdw","YES")</span><br><br>But despite building with this version of GHC, still when I send `SIGQUIT` to a process built with this version of GHC, I just get the message:<br><br><span style="color:rgb(28,28,28);font-family:"Noto Sans",Arial,sans-serif;font-size:14px">"This build does not support backtraces."</span><br><br>Now I have also been building my packages with `-g`, passing `--enable-debug-info` etc, although it's my understanding that what I've done just with building GHC with `--enable-dwarf-unwind` _should_ be enough to get a backtrace upon SIGQUIT, it might just be a poor one if the debugging symbols aren't added.<br><br>But clearly I've missed something if it's not working. I'm not quite sure what set of circumstances the message <span style="color:rgb(28,28,28);font-family:"Noto Sans",Arial,sans-serif;font-size:14px">"This build does not support backtraces"</span> is displayed? Is there a runtime check to see whether the "libdw" library is actually in the library path, in addition to the requirement that GHC be built with libdw support? If that's the case, perhaps as I'm running this on NixOS I need to add something to my executable's LD_LIBRARY_PATH or something? Or is there some option I need to give GHC/Cabal to ensure that backtrace support is added to the executable's runtime as well as making sure I've compiled with GHC that's compiled with libdw support? Or is there some other runtime RTS option I need to give to my executable?<br><br>As you can see, I'm completely lost about how to move forward on this, so any help would be very much appreciated.<br><br>Thanks,<br>Clinton</div></div>