Skip to content

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
8--------\r\nimport DynFlags\r\n\r\nimport GHC\r\n\r\nmain = defaultErrorHandler defaultDynFlags $ do\r\n session <- newSession (Just \"d:\\\\app\\\\ghc-6.8.2\")\r\n flags <- getSessionDynFlags session\r\n (flags, _) <- parseDynamicFlags flags []\r\n GHC.defaultCleanupHandler flags $ do\r\n setSessionDynFlags session flags{ hscTarget=HscInterpreted }\r\n prelude <- findModule session (mkModuleName \"Prelude\") Nothing\r\n setContext session [] [prelude]\r\n runStmt session \"let n = 2 + 2\" RunToCompletion \r\n runStmt session \"n\" RunToCompletion \r\n----->8--------\r\n}}}\r\n\r\n\r\nYou get the following error:\r\n\r\n\r\n{{{\r\nLoading package array-0.1.0.0 ... linking ... done.\r\nLoading package packedstring-0.1.0.0 ... linking ... done.\r\nLoading package containers-0.1.0.1 ... linking ... done.\r\nLoading package old-locale-1.0.0.0 ... linking ... done.\r\nLoading package old-time-1.0.0.0 ... linking ... done.\r\nLoading package filepath-1.1.0.0 ... linking ... done.\r\nLoading package directory-1.0.0.0 ... linking ... done.\r\nLoading package process-1.0.0.0 ... linking ... done.\r\nLoading package pretty-1.0.0.0 ... linking ... done.\r\nLoading package hpc-0.5.0.0 ... linking ... done.\r\nLoading package template-haskell ... linking ... done.\r\nLoading package Cabal-1.2.3.0 ... linking ... done.\r\nLoading package random-1.0.0.0 ... linking ... done.\r\nLoading package haskell98 ... linking ... done.\r\nLoading package bytestring-0.9.0.1 ... linking ... done.\r\nLoading package Win32-2.1.1.0 ... linking ... done.\r\nLoading package ghc-6.8.2 ... linking ... done.\r\n\r\n\r\nGHCi runtime linker: fatal error: I found a duplicate definition for symbol\r\n _forkOS_entry\r\nwhilst processing object file\r\n d:/app/ghc-6.8.2/lib\\base-3.0.1.0/HSbase-3.0.1.0.o\r\nThis could be caused by:\r\n * Loading two different object files which export the same symbol\r\n * Specifying the same object file twice on the GHCi command line\r\n * An incorrect `package.conf' entry, causing some object to be\r\n loaded twice.\r\nGHCi cannot safely continue in this situation. Exiting now. Sorry.\r\n\r\n}}}\r\n\r\nIt 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.\r\n\r\nI haven't tried with GHC 6.9 yet. \r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information