From bf7fea4f1de3d915877564f560654b2b723ac23e Mon Sep 17 00:00:00 2001 From: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com> Date: Thu, 15 Aug 2019 15:27:26 +0200 Subject: [PATCH] hie-core exe: initDynLinker (#2555) 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. --- exe/Main.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/exe/Main.hs b/exe/Main.hs index a7b41b51..31acebaf 100644 --- a/exe/Main.hs +++ b/exe/Main.hs @@ -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 @@ -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