Cabal Include-Dirs link to RTS

Matthew Le (RIT Student) ml9951 at
Wed Jul 15 17:53:06 UTC 2015

I am currently working on an alternative implementation of the STM monad
and would like to keep my work as isolated as possible.  To that end, I
have tried to keep all my files separate in a confined package.  The
package consists of haskell files which are exported to the programmer, a
C-- file which is used by the haskell functions, and a C file, which is
called from some of the C-- primitives.  Inside my C file, I need to call a
couple of functions that exist in the RTS, such as "dirty_TVAR" from
(rts/sm/Storage.h).  Is there a good way to include this header file in my
C file?  I would like to be able to list rts/sm in my cabal file under
Include-Dirs.  I'm wondering if there is something analogous to an
environment variable or anchor names (from SML/NJ compilation manager) that
can tell me where the GHC source directory root is.  As an example, I would
like to do something to the effect of:

  Include-Dirs: $GHC_ROOT/rts, $GHC_ROOT/rts/sm

where $GHC_ROOT would tell cabal where to find the ghc source directory in
the file system.  I tried giving a relative path (which as expected does
not work), giving the following warning:

Warning: 'include-dirs: ../../rts' is a relative path outside of the source

tree. This will not work when generating a tarball with 'sdist'.

I can give an absolute path for my machine and everything compiles just
fine, but this is obviously not portable.  Any help would be much

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list