PS:  Note [Bootstrapping Template Haskell] does not mention BOOTSTRAP_TH!


On Wed, 25 Mar 2026 at 13:08, Simon Peyton Jones <
[email protected]> wrote:

> I think to avoid this you will need to be careful to only apply these
>> flags when the BOOTSTRAP_TH flag is set.
>> In particular, I think what's happening is that we try to find the
>> GHC.KnownKey module and then start pulling in all of ghc-internal.
>
>
> Ah yes.   The command line does indeed invoke the *bootstrap *compiler,
> which of course does now know these flags.
>
> *But what business does the bootstrap compiler have with compiling
> GHC.Internal.Classes? * I would be entirely unsurprised if the bootstrap
> compiler stumbled on compiling a module that is so closely coupled to GHC's
> internals.
>
> Simon
>
> On Wed, 25 Mar 2026 at 13:02, Teo Camarasu <[email protected]> wrote:
>
>> Hi Simon,
>>
>> Note that this is occurring while compiling `ghc-boot-th-next`. This
>> package vendors the TemplateHaskell interfaces from ghc-internal and is
>> built by the boot compiler. You will find a bunch of CPP in the
>> TemplateHaskell modules like `GHC.Internal.TH.Syntax` that switches out
>> `ghc-internal` imports for `base` imports when bootstrapping so we can
>> compile with the boot compiler. For more context see `Note [Bootstrapping
>> Template Haskell]`.
>>
>> I think to avoid this you will need to be careful to only apply these
>> flags when the BOOTSTRAP_TH flag is set.
>> In particular, I think what's happening is that we try to find the
>> GHC.KnownKey module and then start pulling in all of ghc-internal.
>>
>> Cheers,
>> Teo
>>
>> On Wed, 25 Mar 2026, at 12:56 PM, Brandon Allbery via ghc-devs wrote:
>>
>> I'd suspect it's your boot compiler producing that error, and that what
>> changed might have been the file being compiled, causing a recompile with
>> the wrong compiler?
>>
>> On Wed, Mar 25, 2026 at 8:53 AM Simon Peyton Jones via ghc-devs <
>> [email protected]> wrote:
>>
>> Friends
>>
>> After 10 days of working on !15719 I have suddenly started getting
>>
>> /home/simonpj/code/HEAD-19/libraries/ghc-boot-th-next/../ghc-internal/src/GHC/Internal/Classes.hs:10:17:
>> error: [GHC-04924]
>>     Unknown flag in  {-# OPTIONS_GHC #-} pragma: -fdefines-known-key-names
>>    |
>> 10 | {-# OPTIONS_GHC -fdefines-known-key-names #-}
>>    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>> I have no idea why this was fine until 10am this morning, and has
>> suddenly started happening now.
>>
>> *How does GHC decide what runtime flags it allows? *
>> `-fdefines-known-key-names` is in GHC.Driver.Session.fFlagsDeps.
>>
>>
>> I'm boggled that it worked until 10am and then abruptly stopped.
>>
>> Any advice?
>>
>> Simon
>>
>> _______________________________________________
>> ghc-devs mailing list -- [email protected]
>> To unsubscribe send an email to [email protected]
>>
>>
>>
>> --
>> brandon s allbery kf8nh
>> [email protected]
>> _______________________________________________
>> ghc-devs mailing list -- [email protected]
>> To unsubscribe send an email to [email protected]
>>
>>
>>
_______________________________________________
ghc-devs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to