Finding GHC RTS headers and other libraries

It seems that there used to be an include dir at $(ghc --print-libdir), however, this is no longer the case. Now, the headers, e.g. of the RTS, are in $(ghc --print-libdir)/aarch64-osx-ghc-9.8.1/rts-1.0.2/include, and of other libraries in different directories…

Is there some blessed way of finding the headers for GHC libraries to include them in a C executable, or what should we do?

There is always $(find $(ghc --print-libdir) -name HsFFI.h)

You run

$(ghc-pkg field rts include-dirs --simple-output);
1 Like

Ah! Perfect, thank you. That is also great for finding include dirs of other libraries.

I wonder if there is a way to recursively (from the cabal package file) discover all include dirs of all required dependencies, instead of manually invoking ghc-pkg for each dependency