help needed configuring GHC API client
Norman Ramsey
nr at cs.tufts.edu
Thu Sep 23 18:30:16 UTC 2021
I'm writing client code against the GHC API in HEAD (version 9.3),
using 9.0.1 as my bootstrap compiler. To make it possible to build
this code, I've set up cabal using
cabal v1-configure \
--package-db clear \
--package-db $STAGE0/lib/package.conf.d/ # stage0 libraries
In my Haskell code I'm invoking `runGhc (Just thelibdir)` where
thelibir = "/home/nr/asterius/ghc/_build/stage0/lib"
which is my `$STAGE0/lib`.
Unfortunuately, when I launch my app, `setSessionDynFlags` panics.
The output, along with some diagnostic information about some dflags
that seemed relevant, looks like this:
libdir = /home/nr/asterius/ghc/_build/stage0/lib
includePaths = IncludeSpecs {includePathsQuote = [], includePathsGlobal = [], includePathsQuoteImplicit = []}
libraryPaths = []
packageDBFlags = []
packageEnv = Nothing
panic! (the 'impossible' happened)
GHC version 9.3.20210918:
GHC couldn't find the RTS constants (#define HS_CONSTANTS ") in /home/nr/.ghcup/ghc/9.0.1/lib/ghc-9.0.1/include/DerivedConstants.h: the RTS package you are trying to use is perhaps for another GHC version(e.g. you are using the wrong package database) or the package database is broken.
CallStack (from HasCallStack):
error, called at _build/stage0/compiler/build/GHC/Platform/Constants.hs:143:20 in ghc:GHC.Platform.Constants
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
I'm a little suprprised that my app is hunting for 9.3 information in
the tree that belongs to the bootstrap compiler.
I could start tinkering with `packageEnv` or other dflags, but I'm on
thin ice here, and I thought it made more sense to ask for advice.
What is going on in my configuration, and how can I set up my app so
it is using the library in my `libdir` rather than the library that
belongs to the bootstrap compiler?
Norman
More information about the ghc-devs
mailing list