Skip to content

GCC error while building ghc-debug-stub

I was following the approach described in this blog post to play around with ghc-debug and I ran into the following error:

ghc-debug-stub          > In file included from /home/ubuntu/.stack/programs/x86_64-linux/ghc-8.10.3/lib/ghc-8.10.3/include/Rts.h:207,
ghc-debug-stub          >
ghc-debug-stub          > /run/user/1000/stack-b43393b9021110df/ghc-debug-stub-0.1.0.0/                 from cbits/socket.cpp:3:0: error:
ghc-debug-stub          >
ghc-debug-stub          > /run/user/1000/stack-b43393b9021110df/ghc-debug-stub-0.1.0.0//home/ubuntu/.stack/programs/x86_64-linux/ghc-8.10.3/lib/ghc-8.10.3/include/rts/storage/Block.h:103:16: error:
ghc-debug-stub          >      error: 'struct bdescr_::<unnamed union>::NonmovingSegmentInfo' invalid; an anonymous union may only have public non-static data members [-fpermissive]
ghc-debug-stub          >       103 |         struct NonmovingSegmentInfo {
ghc-debug-stub          >           |                ^~~~~~~~~~~~~~~~~~~~
ghc-debug-stub          >     |
ghc-debug-stub          > 103 |         struct NonmovingSegmentInfo {
ghc-debug-stub          >     |                ^
ghc-debug-stub          > `gcc' failed in phase `C Compiler'. (Exit code: 1)

I added withGhcDebug to my application, entered a nix-shell for the ghc-debug repo, and got that error while building my app with stack on an Ubuntu Linux machine. Any ideas about how to fix this?