Skip to content

Commit 9a43f87

Browse files
committed
fix: guard Config/Interpreter.hs with HAVE_INTERPRETER
When building without interpreter support (-interpreter flag), InterpOpts is a stub empty data type without any fields. The initInterpOpts function was trying to use all 20+ InterpOpts fields unconditionally, causing build failures. This fix makes the entire module conditional on HAVE_INTERPRETER: - When defined: full implementation creating InterpOpts with all fields - When not defined: stub that returns empty InterpOpts This allows stage1 minimal builds (without interpreter) to complete successfully.
1 parent 2ac45f4 commit 9a43f87

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

compiler/GHC/Driver/Config/Interpreter.hs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
{-# LANGUAGE CPP #-}
2+
13
module GHC.Driver.Config.Interpreter
24
( initInterpOpts
35
)
46
where
57

8+
#if defined(HAVE_INTERPRETER)
9+
610
import GHC.Prelude
711
import GHC.Runtime.Interpreter.Init
812
import GHC.Driver.DynFlags
@@ -44,3 +48,15 @@ initInterpOpts dflags = do
4448
, interpExecutableLinkOpts = initExecutableLinkOpts dflags
4549
}
4650

51+
#else
52+
-- Stub version when HAVE_INTERPRETER is not defined
53+
54+
import GHC.Prelude
55+
import GHC.Runtime.Interpreter.Init (InterpOpts(..))
56+
import GHC.Driver.Session (DynFlags)
57+
58+
-- | Stub initInterpOpts - returns empty InterpOpts when interpreter is disabled
59+
initInterpOpts :: DynFlags -> IO InterpOpts
60+
initInterpOpts _ = pure InterpOpts
61+
62+
#endif

0 commit comments

Comments
 (0)