Using GHC 6.8.2 as a library does not work well under Windows in GHCi
When executing the following code with GHCi 6.8.2 under Windows
----->8--------
import DynFlags
import GHC
main = defaultErrorHandler defaultDynFlags $ do
session <- newSession (Just "d:\\app\\ghc-6.8.2")
flags <- getSessionDynFlags session
(flags, _) <- parseDynamicFlags flags []
GHC.defaultCleanupHandler flags $ do
setSessionDynFlags session flags{ hscTarget=HscInterpreted }
prelude <- findModule session (mkModuleName "Prelude") Nothing
setContext session [] [prelude]
runStmt session "let n = 2 + 2" RunToCompletion
runStmt session "n" RunToCompletion
----->8--------
You get the following error:
Loading package array-0.1.0.0 ... linking ... done.
Loading package packedstring-0.1.0.0 ... linking ... done.
Loading package containers-0.1.0.1 ... linking ... done.
Loading package old-locale-1.0.0.0 ... linking ... done.
Loading package old-time-1.0.0.0 ... linking ... done.
Loading package filepath-1.1.0.0 ... linking ... done.
Loading package directory-1.0.0.0 ... linking ... done.
Loading package process-1.0.0.0 ... linking ... done.
Loading package pretty-1.0.0.0 ... linking ... done.
Loading package hpc-0.5.0.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package Cabal-1.2.3.0 ... linking ... done.
Loading package random-1.0.0.0 ... linking ... done.
Loading package haskell98 ... linking ... done.
Loading package bytestring-0.9.0.1 ... linking ... done.
Loading package Win32-2.1.1.0 ... linking ... done.
Loading package ghc-6.8.2 ... linking ... done.
GHCi runtime linker: fatal error: I found a duplicate definition for symbol
_forkOS_entry
whilst processing object file
d:/app/ghc-6.8.2/lib\base-3.0.1.0/HSbase-3.0.1.0.o
This could be caused by:
* Loading two different object files which export the same symbol
* Specifying the same object file twice on the GHCi command line
* An incorrect `package.conf' entry, causing some object to be
loaded twice.
GHCi cannot safely continue in this situation. Exiting now. Sorry.
It works fine under Linux. It also works when using GHC --make under Windows, however I do get errors when using hs-plugins under Windows, which seems related.
I haven't tried with GHC 6.9 yet.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.8.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | GHC API |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |