haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 211 forks source link

HIE 1.0.0.0 crash at startup (works fine in 0.14.0.0) #1555

Open vaclavsvejcar opened 4 years ago

vaclavsvejcar commented 4 years ago

So I use HIE + VSCode with this my project: https://github.com/vaclavsvejcar/svejcar-dev, it's basically just small Hakyll-powered blog with just few dependencies. Everything works fine with HIE 0.14.0.0, but after upgrading to 1.0.0.0, I'm getting this error:

2020-01-06 15:48:33.878675 [ThreadId 4] - Run entered for HIE(hie) Version 1.0.0.0, Git revision 6fb1a548846a38a44659e5746718fbd1b1d278d9 (dirty) (3570 commits) x86_64 ghc-8.6.5
2020-01-06 15:48:33.879658 [ThreadId 4] - Operating as a LSP server on stdio
2020-01-06 15:48:33.879743 [ThreadId 4] - Current directory:/Users/vaclav/Desktop/Projekty/VaclavSvejcar/svejcar-dev
2020-01-06 15:48:33.879808 [ThreadId 4] - Operating system:darwin
2020-01-06 15:48:33.879868 [ThreadId 4] - args:["--lsp"]
2020-01-06 15:48:33.92621 [ThreadId 4] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/Users/vaclav/Desktop/Projekty/VaclavSvejcar/svejcar-dev/stack.yaml"}
2020-01-06 15:48:36.024834 [ThreadId 4] - Module "/Users/vaclav/Desktop/Projekty/VaclavSvejcar/svejcar-dev/File.hs" is loaded by Cradle: Cradle {cradleRootDir = "/Users/vaclav/Desktop/Projekty/VaclavSvejcar/svejcar-dev", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-06 15:48:36.025096 [ThreadId 4] - Use Stack GHC
2020-01-06 15:48:36.389384 [ThreadId 28] - Use Stack GHC
Using hie version: Version 1.0.0.0, Git revision 6fb1a548846a38a44659e5746718fbd1b1d278d9 (dirty) (3570 commits) x86_64 ghc-8.6.5
2020-01-06 15:48:36.808697 [ThreadId 34] - New cradle: /Users/vaclav/Desktop/Projekty/VaclavSvejcar/svejcar-dev/src/Site/Tags.hs
2020-01-06 15:48:36.813945 [ThreadId 34] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/Users/vaclav/Desktop/Projekty/VaclavSvejcar/svejcar-dev/stack.yaml"}
Using hoogle db at: /Users/vaclav/.hoogle/default-haskell-5.0.17.hoo
2020-01-06 15:48:38.490342 [ThreadId 34] - Module "/Users/vaclav/Desktop/Projekty/VaclavSvejcar/svejcar-dev/src/Site/Tags.hs" is loaded by Cradle: Cradle {cradleRootDir = "/Users/vaclav/Desktop/Projekty/VaclavSvejcar/svejcar-dev", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-06 15:48:38.490438 [ThreadId 34] - Found cradle: Cradle {cradleRootDir = "/Users/vaclav/Desktop/Projekty/VaclavSvejcar/svejcar-dev", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
svejcar-dev> configure (exe)
Configuring svejcar-dev-1.4.5.0...
hie: 
lookupSymbol failed in relocateSection (relocate external)
/Users/vaclav/.stack/snapshots/x86_64-osx/b3c56b98f10ec8b0a8d3bd84c23ac3a040aa900e31148e859e36eec26ac40918/8.6.5/lib/x86_64-osx-ghc-8.6.5/hlibsass-0.1.8.0-8bl4Bh71glAA05Gm5wxyUi/libsass.a: unknown symbol `__ZN4Sass9SharedObjD2Ev'
hie: 
lookupSymbol failed in relocateSection (relocate external)
/Users/vaclav/.stack/snapshots/x86_64-osx/b3c56b98f10ec8b0a8d3bd84c23ac3a040aa900e31148e859e36eec26ac40918/8.6.5/lib/x86_64-osx-ghc-8.6.5/hlibsass-0.1.8.0-8bl4Bh71glAA05Gm5wxyUi/libsass.a: unknown symbol `__ZN4Sass9SharedPtrD2Ev'
GHC runtime linker: fatal error: I found a duplicate definition for symbol
   __ZN4Sass10DefinitionC2ENS_11ParserStateEPKcNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS_10SharedImplINS_10ParametersEEEPFPNS_10ExpressionERNS_11EnvironmentINSB_INS_8AST_NodeEEEEESK_RNS_7ContextES3_S1_NS4_6vectorINS_9BacktraceENS8_ISO_EEEENSN_INSB_INS_13Selector_ListEEENS8_ISS_EEEEEb
whilst processing object file
   /Users/vaclav/.stack/snapshots/x86_64-osx/b3c56b98f10ec8b0a8d3bd84c23ac3a040aa900e31148e859e36eec26ac40918/8.6.5/lib/x86_64-osx-ghc-8.6.5/hlibsass-0.1.8.0-8bl4Bh71glAA05Gm5wxyUi/libsass.a
The symbol was previously defined in
   /Users/vaclav/.stack/snapshots/x86_64-osx/b3c56b98f10ec8b0a8d3bd84c23ac3a040aa900e31148e859e36eec26ac40918/8.6.5/lib/x86_64-osx-ghc-8.6.5/hlibsass-0.1.8.0-8bl4Bh71glAA05Gm5wxyUi/libsass.a(context.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.
hie: 
lookupSymbol failed in relocateSection (relocate external)
/Users/vaclav/.stack/snapshots/x86_64-osx/b3c56b98f10ec8b0a8d3bd84c23ac3a040aa900e31148e859e36eec26ac40918/8.6.5/lib/x86_64-osx-ghc-8.6.5/hlibsass-0.1.8.0-8bl4Bh71glAA05Gm5wxyUi/libsass.a: unknown symbol `__ZN4Sass9SharedPtrD2Ev'
GHC runtime linker: fatal error: I found a duplicate definition for symbol
   __ZN4Sass10Expression11set_delayedEb
whilst processing object file
   /Users/vaclav/.stack/snapshots/x86_64-osx/b3c56b98f10ec8b0a8d3bd84c23ac3a040aa900e31148e859e36eec26ac40918/8.6.5/lib/x86_64-osx-ghc-8.6.5/hlibsass-0.1.8.0-8bl4Bh71glAA05Gm5wxyUi/libsass.a
The symbol was previously defined in
   /Users/vaclav/.stack/snapshots/x86_64-osx/b3c56b98f10ec8b0a8d3bd84c23ac3a040aa900e31148e859e36eec26ac40918/8.6.5/lib/x86_64-osx-ghc-8.6.5/hlibsass-0.1.8.0-8bl4Bh71glAA05Gm5wxyUi/libsass.a(ast.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.

When I build the project using stack build, it works just fine. I tried building the project from scratch, reinstalling HIE multiple times, deleting entire ~/.stack, but nothing works. It looks to me that HIE 1.0.0.0 has some issues with linking the libsass.a native library, which is used by the hlibsass Haskell library.

To reproduce this issue, you can simply just clone that repo and try with HIE. When I downgrade to 0.14.0.0, everything works good again. Not sure whether this is or isn't mac-only related issue, as I have no non-mac environment to try on.

Environment

fendor commented 4 years ago

I tried the project with cabal and ghc 8.6.4 on nixos, there it seems to work. Maybe macos specific? Ill try later.

vaclavsvejcar commented 4 years ago

@fendor Thanks for the response. It's possible this issue is macOS-specific, it also seems it may be related to #1541 where the issue author obviously also uses macOS, the error seems to be the very similar and GHC is also 8.6.5. Do you have any chance to test this issue on macOS or should somehow figure out how to test it on different platform?

fendor commented 4 years ago

I have access to a mac machine, so I am trying it now. However, building that project takes like an hour :D

vaclavsvejcar commented 4 years ago

Oh I see :-D Anyway let me know if you'll need some more info about the error or environment I use. Unfortunately I have absolutely no clue how HIE works internally so I guess I won't be much helpful with solving the issue itself.

Anrock commented 4 years ago

Not sure if I'm having same issue, but after updating to 903bd869 HIE seems to be crashing or something with neovim + coc on linux on the same project it was working fine before. Output log is kinda similar except I get server connection closed after module is loaded by cradle and then coc restarts HIE infinitely. Do I need some additional flags to get more output from HIE or that's it? At this moment coc launches hie-wrapper without arguments and I've only set trace.server to verbose in coc config.

2020-01-06 20:41:00.657356971 [ThreadId 4] - run entered for hie-wrapp
er(hie-wrapper) Version 1.0.0.0,
 Git revision 903bd869fddccfa6c303
49a4a373c2d9c9b94e18 (3573 commit
s) x
86_64 ghc-8.6.5
2020-01-06 20:41:00.667415069
 [ThreadId 4] - Current directory:/home/anr
ock/Projects/fancon
2020-01-
06 20:41:00.668059454 [ThreadId 4]
 - Operating system:linux
2020
-01-06 20:41:00.668432112 [Thread
Id 4] - args:[]
202
0-01-06 20:41:00.
670767318 [Thread
Id 4] - Cabal-H
elper decided to 
use: ProjLoc
StackYaml {plSt
ackYaml = "/hom
e/anrock/Projec
ts/fancon/stack
.yaml"}
2020-
01-06 20:41:02.360027734 [ThreadId 4] - Module "/home/anrock/Projects/f
ancon/File.hs" is loaded by Cr
adle: Cradle {cradleRootDir = "
/home/anrock/Projects/fancon
", cradleOptsProg = CradleAction
: Cabal-Helper-Stack}
2020-01-06 20:41:02
.361489065 [ThreadId 4] - Cradle di
rectory:/home/anrock/Projects
/fancon
20
20-01-06 20:41:
02.362250983 [Th
readId 4] - Use Stac
k GHC
2020-01-06 20:41:
02.721017471 [ThreadId 4] - Project GHC version:8.6.5
2020-01-06 20:41:
02.721255845 [ThreadId 4] - h
ie exe candidates :["hie-8.6.5","
hie-8.6","hie"]
202
0-01-06 20:41:02.7226
96747 [ThreadId 4] - found hie 
exe at:/home/anrock/.local/bin
/hie-8.6.5
2020-01-
06 20:41:02.723376539 [T
hreadId 4] - args:[]
2020-01-06 20:41:02.723779975 [ThreadId 
4] - launching ....

2020-01-06 20:41:02.729628981 [ThreadId 4] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/home/anrock/Projects/fancon/stack.yaml"}
2020-01-06 20:41:04.434999678 [ThreadId 4] - Module "/home/anrock/Projects/fancon/File.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/anrock/Projects/fancon", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-
06 20:41:04.438350388 [ThreadId 4] - done

[Info  - 20:41:04 GMT+0300 (MSK)] Connection to server got closed. Server will restart.
fendor commented 4 years ago

@Anrock You are probably missing the --lsp flag. Without it, hie mirrors now ghcide and produces initial diagnostics for the current project.

Anrock commented 4 years ago

@fendor yup, that's it. Totally forgot about this change. Gotta update the readme for this.

vaclavsvejcar commented 4 years ago

One more thing, I tried HIE 1.0.0.0 with my other Haskell projects and it works fine there, but these (AFAIK) don't use any libraries using native code. So maybe the issue is somehow related only to macOS + dependencies using external libraries?

fendor commented 4 years ago

I tried on macos and couldnt even build the project with stack. It probably is somehow related to external libraries, but I have no further pointers on how to debug it. Needs some more investigating.

vaclavsvejcar commented 4 years ago

Unfortunately I don't remember which libraries exactly (if any) I had to install using Homebrew. Maybe can you post the error log here?

fendor commented 4 years ago

I will try again tomorrow and post the logs here if a quick google search does not yield the desired results!

vaclavsvejcar commented 4 years ago

@fendor Any luck with macOS testing? Do you need any help from my side?

andys8 commented 4 years ago

I'm experiencing similar results after updating to 1.0.0.0 (0.14.0.0 is working fine).

OS: Manjaro 18.1.5 Juhraya Kernel: x86_64 Linux 5.4.6-2-MANJARO GHC 8.6.5 Installed with nix (all-hies) Project: https://github.com/andys8/git-brunch Vim + CoC

2020-01-10 12:07:57.714413863 [ThreadId 35] - Ghc error on cradle initialisation: "can't load .so/.DLL for: /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/libpthread.so (/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/libpthread.so: symbol __write_nocancel version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference)"
2020-01-10 12:07:57.714641017 [ThreadId 35] - ghcDispatcher:Got error for a request: IdeError {ideCode = OtherError, ideMessage = "\"can't load .so/.DLL for: /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/libpthread.so (/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/libpthread.so: symbol __write_nocancel version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference)\"", ideInfo = Null} with mid: Nothing

Full log

## versions

vim version: VIM - Vi IMproved 8.1 (2018 May 18, compiled Nov  7 2019 22:30:47)
node version: v12.5.0
coc.nvim version: 0.0.74-db5ffd2ff0
term: dumb
platform: linux

## Messages
Messages maintainer: Bram Moolenaar <Bram@vim.org>
"src/GitBrunch.hs" 192L, 6600C
[coc.nvim] Definition provider not found for current document
[coc.nvim] "can't load .so/.DLL for: /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/libpthread.so (/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/libpthread.so: symbol __write_nocancel version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference)"
[coc.nvim] "panic! (the 'impossible' happened)\n  (GHC version 8.6.5 for x86_64-unknown-linux):\n\tDynamic linker not initialised\n\nPlease report this as a GHC bug:  http://www.haskell.org/ghc/reportabug\n"
## Output channel: prettier

## Output channel: languageserver.haskell

[Trace - 12:07:51 PM] Sending request 'initialize - (0)'.
Params: {
    "processId": 9386,
    "rootPath": "/home/andreas/dev/repository/git-brunch",
    "rootUri": "file:///home/andreas/dev/repository/git-brunch",
    "capabilities": {
        "workspace": {
            "applyEdit": true,
            "workspaceEdit": {
                "documentChanges": true,
                "resourceOperations": [
                    "create",
                    "rename",
                    "delete"
                ],
                "failureHandling": "textOnlyTransactional"
            },
            "didChangeConfiguration": {
                "dynamicRegistration": true
            },
            "didChangeWatchedFiles": {
                "dynamicRegistration": true
            },
            "symbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                }
            },
            "executeCommand": {
                "dynamicRegistration": true
            },
            "configuration": true,
            "workspaceFolders": true
        },
        "textDocument": {
            "publishDiagnostics": {
                "relatedInformation": true
            },
            "synchronization": {
                "dynamicRegistration": true,
                "willSave": true,
                "willSaveWaitUntil": true,
                "didSave": true
            },
            "completion": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "completionItem": {
                    "snippetSupport": true,
                    "commitCharactersSupport": true,
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "deprecatedSupport": true,
                    "preselectSupport": true
                },
                "completionItemKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25
                    ]
                }
            },
            "hover": {
                "dynamicRegistration": true,
                "contentFormat": [
                    "markdown",
                    "plaintext"
                ]
            },
            "signatureHelp": {
                "dynamicRegistration": true,
                "signatureInformation": {
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "parameterInformation": {
                        "labelOffsetSupport": true
                    }
                }
            },
            "definition": {
                "dynamicRegistration": true
            },
            "references": {
                "dynamicRegistration": true
            },
            "documentHighlight": {
                "dynamicRegistration": true
            },
            "documentSymbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                }
            },
            "codeAction": {
                "dynamicRegistration": true,
                "codeActionLiteralSupport": {
                    "codeActionKind": {
                        "valueSet": [
                            "",
                            "quickfix",
                            "refactor",
                            "refactor.extract",
                            "refactor.inline",
                            "refactor.rewrite",
                            "source",
                            "source.organizeImports"
                        ]
                    }
                }
            },
            "codeLens": {
                "dynamicRegistration": true
            },
            "formatting": {
                "dynamicRegistration": true
            },
            "rangeFormatting": {
                "dynamicRegistration": true
            },
            "onTypeFormatting": {
                "dynamicRegistration": true
            },
            "rename": {
                "dynamicRegistration": true,
                "prepareSupport": true
            },
            "documentLink": {
                "dynamicRegistration": true
            },
            "typeDefinition": {
                "dynamicRegistration": true
            },
            "implementation": {
                "dynamicRegistration": true
            },
            "declaration": {
                "dynamicRegistration": true
            },
            "colorProvider": {
                "dynamicRegistration": true
            },
            "foldingRange": {
                "dynamicRegistration": true,
                "rangeLimit": 5000,
                "lineFoldingOnly": true
            }
        }
    },
    "initializationOptions": {
        "languageServerHaskell": {
            "hlintOn": true,
            "maxNumberOfProblems": 10,
            "completionSnippetsOn": false,
            "formattingProvider": "brittany"
        }
    },
    "trace": "verbose",
    "workspaceFolders": [
        {
            "uri": "file:///home/andreas/dev/repository/git-brunch",
            "name": "git-brunch"
        }
    ]
}

202
0-01-10 12:07:51.497031989 [ThreadId 4] - run entered for hie-wrapper(
hie-wrappe
r) Version 1.0.0.0 
x86_64 
ghc-8.6.5
2020-01-
10 12:07:51.49790
5182 [ThreadId 4] - Cur
rent directory:/home/a
ndreas/dev/repository/git-brunch

2020-01-10 1
2:07:51.498116866 [
ThreadId 4] - Operating sys
tem:linux
2
020-01-10 12:07:51
.498253903 [ThreadId 4] -
 args:["--lsp"]
2020-01-10 12:07:
51.499258575 [ThreadId 4] - Cabal-Helper decided to use: P
rojLocStackYaml {plStackYaml = "/home/andr
eas/dev/repository/git-brunch/stack.yaml
"}
2020-01-
10 12:07:52.926678622 [ThreadId 4] - Module "/home/andreas/dev/reposit
ory/git-brunch/File.h
s" is loade
d by Cradle: Cradle {cradleRo
otDir = "/home/andreas/
dev/repository/git-brunch"
, cradleOptsProg = Crad
leAct
ion: Cabal-Helper-Stack}
2020-
01-10 12:07:52.92771
8002 [ThreadId 4] - Cradle di
rectory:/home/andreas/dev/rep
ository/git-brunch
2020-
01-10 12:07:52.928126177 [Thr
eadId 4] - Use Stack GHC
2020-01-10 12:07:53.263
989295 [ThreadId 4] - Project GHC version:8.6.5
2020-01-10 12:07:53.26
4211607 [ThreadId 4] - hi
e exe candidates :["hie-8.6.5","hie-8.6","
hie"]
2020-01-10 12:07:53.264
775457 [ThreadId 4] - found hie exe at:/nix/store/ymkpyr7
fl6ziwk77k7bhxy21jd93x3vv-haskell-ide-engi
ne-combined/libexec/bin/hie-8.6.5
2020-01-10 12:07:
53.265078596 [ThreadId 4] 
- args:["--lsp"]
2020
-01-10 12:07:53.265195103
 [ThreadId 4] - launching ....

2020-01-10 12:07:53.736054738 [ThreadId 4] - Run entered for HIE(hie-8.6.5) Version 1.0.0.0 x86_64 ghc-8.6.5
2020-01-10 12:07:53.73624686 [ThreadId 4] - Operating as a LSP server on stdio
2020-01-10 12:07:53.736317887 [ThreadId 4] - Current directory:/home/andreas/dev/repository/git-brunch
2020-01-10 12:07:53.736395905 [ThreadId 4] - Operating system:linux
2020-01-10 12:07:53.736445388 [ThreadId 4] - args:["--lsp"]
2020-01-10 12:07:53.738542035 [ThreadId 4] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/home/andreas/dev/repository/git-brunch/stack.yaml"}
2020-01-10 12:07:55.115039705 [ThreadId 4] - Module "/home/andreas/dev/repository/git-brunch/File.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/andreas/dev/repository/git-brunch", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-10 12:07:55.115234811 [ThreadId 4] - Use Stack GHC
2020-01-10 12:07:55.433589191 [ThreadId 29] - Use Stack GHC
[Trace - 12:07:55 PM] Received response 'initialize - (0)' in 4350ms.
Result: {
    "capabilities": {
        "typeDefinitionProvider": true,
        "foldingRangeProvider": false,
        "textDocumentSync": {
            "openClose": true,
            "change": 2,
            "willSave": false,
            "willSaveWaitUntil": false,
            "save": {
                "includeText": false
            }
        },
        "workspace": {},
        "implementationProvider": true,
        "documentRangeFormattingProvider": true,
        "documentHighlightProvider": true,
        "executeCommandProvider": {
            "commands": [
                "9521:applyrefact:applyOne",
                "9521:applyrefact:applyAll",
                "9521:generic:type",
                "9521:ghcmod:check",
                "9521:ghcmod:type",
                "9521:ghcmod:casesplit",
                "9521:hsimport:import",
                "9521:package:add",
                "9521:pragmas:addPragma"
            ]
        },
        "renameProvider": false,
        "colorProvider": false,
        "definitionProvider": true,
        "hoverProvider": true,
        "codeActionProvider": true,
        "completionProvider": {
            "triggerCharacters": [
                "."
            ],
            "resolveProvider": true
        },
        "documentSymbolProvider": true,
        "documentFormattingProvider": true,
        "referencesProvider": true
    }
}

[Trace - 12:07:55 PM] Sending notification 'initialized'.
Params: {}

[Trace - 12:07:55 PM] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:///home/andreas/dev/repository/git-brunch/src/GitBrunch.hs",
        "languageId": "haskell",
        "version": 1,
        "text": "{-# LANGUAGE OverloadedStrings #-}\n{-# LANGUAGE RankNTypes #-}\nmodule GitBrunch\n  ( main\n  )\nwhere\n\nimport           Data.Maybe                     ( fromMaybe )\nimport qualified Graphics.Vty                  as V\nimport           Lens.Micro                     ( (^.) -- view\n                                                , (.~) -- set\n                                                , (%~) -- over\n                                                , (&)\n                                                , Lens'\n                                                , lens\n                                                )\n\nimport qualified Brick.Main                    as M\nimport           Brick.Types                    ( Widget )\nimport           Brick.Themes                   ( themeToAttrMap )\nimport qualified Brick.Types                   as T\nimport qualified Brick.Widgets.Border          as B\nimport qualified Brick.Widgets.Border.Style    as BS\nimport qualified Brick.Widgets.Center          as C\nimport           Brick.Widgets.Core             ( hLimit\n                                                , str\n                                                , vBox\n                                                , hBox\n                                                , padAll\n                                                , padLeft\n                                                , padRight\n                                                , withAttr\n                                                , withBorderStyle\n                                                , (<+>)\n                                                )\nimport qualified Brick.Widgets.List            as L\nimport qualified Data.Vector                   as Vec\nimport           Data.List\nimport           Data.Char\n\nimport           Git\nimport           Theme                          ( theme )\n\n\ndata Name = Local | Remote deriving (Ord, Eq, Show)\ndata State = State { _focus :: Name, _localBranches :: L.List Name Branch, _remoteBranches :: L.List Name Branch }\n\n\nmain :: IO ()\nmain = do\n  branches   <- Git.listBranches\n  finalState <- M.defaultMain app (initialState branches)\n  printResult =<< checkoutBranch (selectedBranch finalState)\n where\n  printResult (Left  err) = putStrLn err\n  printResult (Right msg) = putStr msg\n  checkoutBranch (Just b) = Git.checkout b\n  checkoutBranch Nothing  = pure $ Left \"No branch selected.\"\n\n\napp :: M.App State e Name\napp = M.App { M.appDraw         = appDraw\n            , M.appChooseCursor = M.showFirstCursor\n            , M.appHandleEvent  = appHandleEvent\n            , M.appStartEvent   = return\n            , M.appAttrMap      = const $ themeToAttrMap theme\n            }\n\n\nappDraw :: State -> [Widget Name]\nappDraw state =\n  [ C.vCenter $ padAll 1 $ vBox\n      [ hBox\n        [ C.hCenter $ toBranchList localBranchesL\n        , C.hCenter $ toBranchList remoteBranchesL\n        ]\n      , str \" \"\n      , instructions\n      ]\n  ]\n where\n  toBranchList lens' = state ^. lens' & (\\l -> drawBranchList (hasFocus l) l)\n  hasFocus     = (_focus state ==) . L.listName\n  instructions = C.hCenter $ hLimit 100 $ hBox\n    [ drawInstruction \"HJKL/arrows\" \"navigate\"\n    , drawInstruction \"Enter\"       \"checkout\"\n    , drawInstruction \"Esc/Q\"       \"exit\"\n    ]\n\n\ndrawBranchList :: Bool -> L.List Name Branch -> Widget Name\ndrawBranchList hasFocus list =\n  withBorderStyle BS.unicodeBold\n    $ B.borderWithLabel (drawTitle list)\n    $ hLimit 80\n    $ L.renderList drawListElement hasFocus list\n where\n  title Local  = map toUpper \"local\"\n  title Remote = map toUpper \"remote\"\n  drawTitle = withAttr \"title\" . str . title . L.listName\n\n\ndrawListElement :: Bool -> Branch -> Widget Name\ndrawListElement _ branch =\n  padLeft (T.Pad 1) $ padRight T.Max $ highlight branch $ str $ show branch\n where\n  highlight (BranchCurrent _) = withAttr \"current\"\n  highlight _                 = id\n\n\ndrawInstruction :: String -> String -> Widget n\ndrawInstruction keys action =\n  withAttr \"key\" (str keys)\n    <+> str \" to \"\n    <+> withAttr \"bold\" (str action)\n    &   C.hCenter\n\n\nappHandleEvent :: State -> T.BrickEvent Name e -> T.EventM Name (T.Next State)\nappHandleEvent state (T.VtyEvent e) =\n  let checkoutBranch  = M.halt state\n      focusLocal      = M.continue $ focusBranches Local state\n      focusRemote     = M.continue $ focusBranches Remote state\n      deleteSelection = focussedBranchesL %~ L.listClear\n      quit            = M.halt $ deleteSelection state\n  in  case e of\n        V.EvKey V.KEsc        [] -> quit\n        V.EvKey (V.KChar 'q') [] -> quit\n        V.EvKey V.KEnter      [] -> checkoutBranch\n        V.EvKey V.KLeft       [] -> focusLocal\n        V.EvKey (V.KChar 'h') [] -> focusLocal\n        V.EvKey V.KRight      [] -> focusRemote\n        V.EvKey (V.KChar 'l') [] -> focusRemote\n        event                    -> navigate state event\nappHandleEvent state _ = M.continue state\n\n\nfocusBranches :: Name -> State -> State\nfocusBranches target state = if state ^. focusL == target\n  then state\n  else state & toL %~ L.listMoveTo selectedIndex & focusL .~ target\n where\n  selectedIndex = fromMaybe 0 $ L.listSelected (state ^. fromL)\n  (fromL, toL)  = case target of\n    Local  -> (remoteBranchesL, localBranchesL)\n    Remote -> (localBranchesL, remoteBranchesL)\n\n\nnavigate :: State -> V.Event -> T.EventM Name (T.Next State)\nnavigate state event = do\n  let update = L.handleListEventVi L.handleListEvent\n  newState <- T.handleEventLensed state focussedBranchesL update event\n  M.continue newState\n\n\ninitialState :: [Branch] -> State\ninitialState branches = State\n  { _focus          = Local\n  , _localBranches  = L.list Local (Vec.fromList local) 1\n  , _remoteBranches = L.list Remote (Vec.fromList remote) 1\n  }\n where\n  (remote, local) = partition isRemote branches\n  isRemote (BranchRemote _ _) = True\n  isRemote _                  = False\n\n\nselectedBranch :: State -> Maybe Branch\nselectedBranch state =\n  snd <$> L.listSelectedElement (state ^. focussedBranchesL)\n\n\n-- Lens\n\nfocussedBranchesL :: Lens' State (L.List Name Branch)\nfocussedBranchesL =\n  let branchLens s = case s ^. focusL of\n        Local  -> localBranchesL\n        Remote -> remoteBranchesL\n  in  lens (\\s -> s ^. branchLens s) (\\s bs -> (branchLens s .~ bs) s)\n\n\nlocalBranchesL :: Lens' State (L.List Name Branch)\nlocalBranchesL = lens _localBranches (\\s bs -> s { _localBranches = bs })\n\n\nremoteBranchesL :: Lens' State (L.List Name Branch)\nremoteBranchesL = lens _remoteBranches (\\s bs -> s { _remoteBranches = bs })\n\n\nfocusL :: Lens' State Name\nfocusL = lens _focus (\\s f -> s { _focus = f })\n"
    }
}

[Trace - 12:07:55 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "Using hie version: Version 1.0.0.0 x86_64 ghc-8.6.5"
}

Using hie version: Version 1.0.0.0 x86_64 ghc-8.6.5
2020-01-10 12:07:55.779064384 [ThreadId 35] - New cradle: /home/andreas/dev/repository/git-brunch/src/GitBrunch.hs
2020-01-10 12:07:55.780059722 [ThreadId 35] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/home/andreas/dev/repository/git-brunch/stack.yaml"}
[Trace - 12:07:55 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "Using hoogle db at: /home/andreas/.hoogle/default-haskell-5.0.17.hoo"
}

Using hoogle db at: /home/andreas/.hoogle/default-haskell-5.0.17.hoo
2020-01-10 12:07:57.134918168 [ThreadId 35] - Module "/home/andreas/dev/repository/git-brunch/src/GitBrunch.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/andreas/dev/repository/git-brunch", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-10 12:07:57.135015072 [ThreadId 35] - Found cradle: Cradle {cradleRootDir = "/home/andreas/dev/repository/git-brunch", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-10 12:07:57.714413863 [ThreadId 35] - Ghc error on cradle initialisation: "can't load .so/.DLL for: /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/libpthread.so (/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/libpthread.so: symbol __write_nocancel version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference)"
2020-01-10 12:07:57.714641017 [ThreadId 35] - ghcDispatcher:Got error for a request: IdeError {ideCode = OtherError, ideMessage = "\"can't load .so/.DLL for: /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/libpthread.so (/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/libpthread.so: symbol __write_nocancel version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference)\"", ideInfo = Null} with mid: Nothing
2020-01-10 12:07:57.714845621 [ThreadId 35] - New cradle: /home/andreas/dev/repository/git-brunch/src/GitBrunch.hs
2020-01-10 12:07:57.715728655 [ThreadId 35] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/home/andreas/dev/repository/git-brunch/stack.yaml"}
[Trace - 12:07:57 PM] Received notification 'window/showMessage'.
Params: {
    "type": 1,
    "message": "\"can't load .so/.DLL for: /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/libpthread.so (/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/libpthread.so: symbol __write_nocancel version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference)\""
}

2020-01-10 12:07:59.186676249 [ThreadId 35] - Module "/home/andreas/dev/repository/git-brunch/src/GitBrunch.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/andreas/dev/repository/git-brunch", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-10 12:07:59.186762674 [ThreadId 35] - Found cradle: Cradle {cradleRootDir = "/home/andreas/dev/repository/git-brunch", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-10 12:07:59.768984713 [ThreadId 35] - Ghc error on cradle initialisation: "panic! (the 'impossible' happened)\n  (GHC version 8.6.5 for x86_64-unknown-linux):\n\tDynamic linker not initialised\n\nPlease report this as a GHC bug:  http://www.haskell.org/ghc/reportabug\n"
2020-01-10 12:07:59.76906212 [ThreadId 35] - ghcDispatcher:Got error for a request: IdeError {ideCode = OtherError, ideMessage = "\"panic! (the 'impossible' happened)\\n  (GHC version 8.6.5 for x86_64-unknown-linux):\\n\\tDynamic linker not initialised\\n\\nPlease report this as a GHC bug:  http://www.haskell.org/ghc/reportabug\\n\"", ideInfo = Null} with mid: Nothing
[Trace - 12:07:59 PM] Received notification 'window/showMessage'.
Params: {
    "type": 1,
    "message": "\"panic! (the 'impossible' happened)\\n  (GHC version 8.6.5 for x86_64-unknown-linux):\\n\\tDynamic linker not initialised\\n\\nPlease report this as a GHC bug:  http://www.haskell.org/ghc/reportabug\\n\""
}
fendor commented 4 years ago

@vaclavsvejcar Not yet. Will get to it this weekend.

Vigilans commented 4 years ago

Receiving Got error while processing diagnostics: can't load .so/.DLL for: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libpthread.so (/lib/x86_64-linux-gnu/libpthread.so.0: symbol __libc_dl_error_tsd version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference) in hie-1.0.0.

Environment:

vaclavsvejcar commented 4 years ago

@fendor Tried again with GHC 8.6.5 and HIE 1.1 and this is still an issue. It's unfortunate because it makes HIE unusable for projects with external C libraries (such as hsass). The only way is to downgrade to HIE 0.14 which works perfectly.