Skip to content

Commit

Permalink
hie-core exe: initDynLinker (digital-asset#2555)
Browse files Browse the repository at this point in the history
The hie-core tests are flaky in stack. They can fail with the following
error message

```
hie-core: panic! (the 'impossible' happened)\n  (GHC version 8.6.5 for x86_64-unknown-linux):
        Dynamic linker not initialised

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
```

Explicitly initializing the dynamic linker at session startup should
avoid this issue.
  • Loading branch information
aherrmann-da authored Aug 15, 2019
1 parent f3f2d33 commit a7fac2f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions compiler/hie-core/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import Development.IDE.Types.Logger
import qualified Data.Text as T
import qualified Data.Text.IO as T
import Language.Haskell.LSP.Messages
import Linker
import Development.IDE.LSP.LanguageServer
import System.Directory.Extra as IO
import System.Environment
Expand Down Expand Up @@ -125,6 +126,9 @@ showEvent lock (EventFileDiagnostics (toNormalizedFilePath -> file) diags) =
showEvent lock e = withLock lock $ print e

newSession' :: Cradle -> IO HscEnv
newSession' cradle = getLibdir >>= \libdir -> runGhc (Just libdir) $ do
initializeFlagsWithCradle "" cradle
getSession
newSession' cradle = getLibdir >>= \libdir -> do
env <- runGhc (Just libdir) $ do
initializeFlagsWithCradle "" cradle
getSession
initDynLinker env
pure env

0 comments on commit a7fac2f

Please sign in to comment.