ghci - running a :reloaded module always causes a fatal linker error
Summary
After upgrading to GHC 8.10.4 with a fresh computer and Windows install, I can't run reloaded code anymore because it always fails with a fatal linker error.
Steps to reproduce
I have a program with a bunch of .hs files that are loaded in the order of their dependencies.
I basically first type :l Badger
to load my program.
Then I change something in that top-level compilation unit (e.g. add a space).
Type :r
and get this error:
GHC runtime linker: fatal error: I found a duplicate definition for symbol
Main_main_closure
The very verbatim new log messages point out the error in detail:
[38 of 38] Compiling Main ( Badger.hs, D:\\Projects\Haskell\final\..\_temp\ghci-temp\ghc6688_0\ghc_4.o )
Ok, 38 modules loaded.
Main> :ma
Badger 2021-04-14/00
[...]
Main> :r
[38 of 38] Compiling Main ( Badger.hs, D:\\Projects\Haskell\final\..\_temp\ghci-temp\ghc6688_0\ghc_192.o )
Ok, 38 modules loaded.
Main> :ma
GHC runtime linker: fatal error: I found a duplicate definition for symbol
Main_main_closure
whilst processing object file
D:\Projects\Haskell\_temp\ghci-temp\ghc6688_0\ghc_192.o
The symbol was previously defined in
D:\Projects\Haskell\_temp\ghci-temp\ghc6688_0\ghc_4.o
The compilation unit is first persisted in ghc_4.o, then in ghc_192.o, and both are named as part of this conflict. The function in question is a simple main :: IO (). This problem seems to be universal - I can't run any :reloaded code anymore. This makes it really hard to use GHCI for anything because everything would always have to be loaded completely from scratch.
Expected behavior
Code that was reloaded with :reload should work without a fatal linker error. The previous GHC(I) 8.8.3 version that was in Stack LTS worked just fine.
Environment
- GHC version used: 8.10.4
- my full ghci command line:
ghci -freverse-errors -I"D:\Projects\Haskell\final\..\headers" -tmpdir "D:\Projects\Haskell\final\..\_temp\ghci-temp" -odir "D:\Projects\Haskell\final\..\_temp\ghci-o" -hidir "D:\Projects\Haskell\final\..\_temp\ghci-hi" -Weverything -Wmissing-signatures -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-implicit-prelude -Wno-missing-deriving-strategies -Wno-missing-fields -Wno-missing-home-modules -Wno-missing-import-lists -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-name-shadowing -Wno-orphans -Wno-partial-fields -Wno-safe -Wno-tabs -Wno-unsafe -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -Wno-compat-unqualified-imports -XNoImplicitPrelude -threaded -fno-gen-manifest -with-rtsopts --nonmoving-gc -XBangPatterns -XCApiFFI -XConstrainedClassMethods -XConstraintKinds -XDisambiguateRecordFields -XDuplicateRecordFields -XEmptyCase -XEmptyDataDeriving -XExistentialQuantification -XExplicitForAll -XExplicitNamespaces -XFlexibleContexts -XFlexibleInstances -XForeignFunctionInterface -XFunctionalDependencies -XGADTs -XGADTSyntax -XGeneralizedNewtypeDeriving -XKindSignatures -XLiberalTypeSynonyms -XMagicHash -XMonoLocalBinds -XMultiParamTypeClasses -XNamedFieldPuns -XParallelListComp -XQuantifiedConstraints -XRankNTypes -XScopedTypeVariables -XStandaloneDeriving -XTypeFamilies -XTypeFamilyDependencies -XTypeOperators -XTypeSynonymInstances -XUnboxedSums -XUnboxedTuples
Optional:
- Operating System: Win 10 x64 Pro
- System Architecture: Intel