help needed configuring GHC API client
Ben Gamari
ben at smart-cactus.org
Fri Sep 24 01:36:45 UTC 2021
Norman Ramsey <nr at cs.tufts.edu> writes:
> 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 suspect that the stages are getting mixed up here. Would it be
possible to post a full reproducer? I'd be happy to investigate further,
but without being able to reproduce locally it's a bit hard to say
anything useful. My recollection is that we look for DerivedConstants.h
in the usual include paths, so there are many ways in which things could
go wrong.
Cheers,
- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20210923/045eed55/attachment.sig>
More information about the ghc-devs
mailing list