haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.71k stars 368 forks source link

Error on module with Persistent's quasi-quote expressions #392

Closed fabioluz closed 2 years ago

fabioluz commented 4 years ago

Subject of the issue

Module with TH code used for generating Persistent entities shows the following error:

Unexpected usage error\n/nix/store/nwsn18fysga1n5s0bj4jp4wfwvlbx8b1-glibc-2.30/lib/libpthread.so: symbol __write_nocancel version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference

It is very similar to the issue that was once solved here (the same file with no changes) https://github.com/haskell/ghcide/issues/581

Your environment

Steps to reproduce

Wait for HLS to initialize.

Expected behaviour

No errors should be shown? Intellisense should work normally.

Actual behaviour

Errors are shown in the console. Intellisense is not working correctly.

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:

Debug output: ``` haskell-language-server version: 0.4.0.0 (GHC: 8.8.2) (PATH: /home/superfabio/.vscode-server/data/User/globalStorage/haskell.haskell/haskell-language-server-0.4.0-linux-8.8.2) (GIT hash: 0a18edde24923251a148cbbc0ae993a6aac83b9c) (haskell-language-server)Ghcide setup tester in /home/superfabio/projects/ride-rio. Report bugs at https://github.com/haskell/haskell-language-server/issues Tool versions found on the $PATH cabal: Not found stack: 2.3.1 ghc: 8.0.2 Step 1/4: Finding files to test in /home/superfabio/projects/ride-rio Found 21 files Step 2/4: Looking for hie.yaml files that control setup Found 1 cradle Step 3/4: Initializing the IDE Step 4/4: Type checking the files [INFO] Consulting the cradle for "/home/superfabio/projects/ride-rio/test/Spec.hs" Output from setting up the cradle Cradle {cradleRootDir = "/home/superfabio/projects/ride-rio", cradleOptsProg = CradleAction: Stack} > Using main module: 1. Package `tripper' component tripper:exe:tripper-exe with main-is file: /home/superfabio/projects/ride-rio/app/Main.hs > The following GHC options are incompatible with GHCi and have not been passed to it: -threaded > Configuring GHCi with the following packages: tripper > /home/superfabio/projects/ride-rio/.stack-work/install/x86_64-linux-nix/1e40d600a21178f87759f864a4596beae8df2fd811b0ed288be21955b37339bd/8.8.2/pkgdb:/home/superfabio/.stack/snapshots/x86_64-linux-nix/1e40d600a21178f87759f864a4596beae8df2fd811b0ed288be21955b37339bd/8.8.2/pkgdb:/nix/store/i70c2gjy0kzhfzbwfsbkhj9d9n61hb7p-ghc-8.8.2/lib/ghc-8.8.2/package.conf.d [INFO] Using interface files cache dir: /home/superfabio/.cache/ghcide/main-78a2e90bda2e3789e935afa855ae450410f41bf1 [INFO] Making new HscEnv[main] [INFO] Consulting the cradle for "/home/superfabio/projects/ride-rio/Setup.hs" Output from setting up the cradle Cradle {cradleRootDir = "/home/superfabio/projects/ride-rio", cradleOptsProg = CradleAction: Stack} File: /home/superfabio/projects/ride-rio/test/Spec.hs Hidden: no Range: 1:8-1:10 Source: typecheck Severity: DsError Message: Not in scope: type constructor or class ‘IO’ File: /home/superfabio/projects/ride-rio/src/Tripper/Models.hs Hidden: no Range: 1:0-2:0 Source: typecheck Severity: DsError Message: Unexpected usage error /nix/store/nwsn18fysga1n5s0bj4jp4wfwvlbx8b1-glibc-2.30/lib/libpthread.so: symbol __write_nocancel version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference > Using main module: 1. Package `tripper' component tripper:exe:tripper-exe with main-is file: /home/superfabio/projects/ride-rio/app/Main.hs > The following GHC options are incompatible with GHCi and have not been passed to it: -threaded > Configuring GHCi with the following packages: tripper > /home/superfabio/projects/ride-rio/.stack-work/install/x86_64-linux-nix/1e40d600a21178f87759f864a4596beae8df2fd811b0ed288be21955b37339bd/8.8.2/pkgdb:/home/superfabio/.stack/snapshots/x86_64-linux-nix/1e40d600a21178f87759f864a4596beae8df2fd811b0ed288be21955b37339bd/8.8.2/pkgdb:/nix/store/i70c2gjy0kzhfzbwfsbkhj9d9n61hb7p-ghc-8.8.2/lib/ghc-8.8.2/package.conf.d [INFO] Using interface files cache dir: /home/superfabio/.cache/ghcide/main-78a2e90bda2e3789e935afa855ae450410f41bf1 [INFO] Using interface files cache dir: /home/superfabio/.cache/ghcide/main-78a2e90bda2e3789e935afa855ae450410f41bf1 [INFO] Making new HscEnv[main,main] File: /home/superfabio/projects/ride-rio/Setup.hs Hidden: no Range: 1:7-1:26 Source: not found Severity: DsError Message: Could not load module ‘Distribution.Simple’ It is a member of the hidden package ‘Cabal-3.0.1.0’. You can run ‘:set -package Cabal’ to expose it. (Note: this unloads all the modules in the current scope.) [INFO] finish: User TypeCheck (took 0.89s) Files that failed: * /home/superfabio/projects/ride-rio/Setup.hs * /home/superfabio/projects/ride-rio/app/Main.hs * /home/superfabio/projects/ride-rio/src/Tripper/Main.hs * /home/superfabio/projects/ride-rio/src/Tripper/Models.hs * /home/superfabio/projects/ride-rio/src/Tripper/Server.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/Auth/Server.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/Auth/Types.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/Client/DB.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/Client/Server.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/User/DB.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/User/Server.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/User/Types.hs * /home/superfabio/projects/ride-rio/test/Spec.hs Completed (8 files worked, 13 files failed) haskell-language-server-0.4.0-linux-8.8.2: allocatestack.c:384: advise_stack_range: Assertion `freesize < size' failed. Aborted ```

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs: ``` [client] run command: "/home/superfabio/.vscode-server/data/User/globalStorage/haskell.haskell/haskell-language-server-0.4.0-linux-8.8.2 --lsp" [client] debug command: "/home/superfabio/.vscode-server/data/User/globalStorage/haskell.haskell/haskell-language-server-0.4.0-linux-8.8.2 --lsp" [client] server cwd: undefined haskell-language-server version: 0.4.0.0 (GHC: 8.8.2) (PATH: /home/superfabio/.vscode-server/data/User/globalStorage/haskell.haskell/haskell-language-server-0.4.0-linux-8.8.2) (GIT hash: 0a18edde24923251a148cbbc0ae993a6aac83b9c) Starting (haskell-language-server)LSP server... with arguments: LspArguments {argLSP = True, argsCwd = Nothing, argFiles = [], argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False} with plugins: [PluginId "brittany",PluginId "eval",PluginId "floskell",PluginId "fourmolu",PluginId "ghcide",PluginId "importLens",PluginId "ormolu",PluginId "pragmas",PluginId "retrie",PluginId "stylish-haskell"] in directory: /home/superfabio/projects/ride-rio If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option! Started LSP server in 0.00s 2020-09-09 18:27:53.8879311 [ThreadId 25] - Opened text document: file:///home/superfabio/projects/ride-rio/src/Tripper/Feature/Shared/Error.hs 2020-09-09 18:27:53.8894477 [ThreadId 74] - Data.HashMap.Internal.(!): key not found CallStack (from HasCallStack): error, called at ./Data/HashMap/Internal.hs:753:16 in unordered-containers-0.2.12.0-ee238bdcbdb407634d69853d9c1f729d7eeed23222d0def9f5d9e1b764c5d32e:Data.HashMap.Internal !, called at src/Development/IDE/Import/DependencyInformation.hs:107:40 in ghcide-0.2.0-inplace:Development.IDE.Import.DependencyInformation 2020-09-09 18:27:53.8900381 [ThreadId 77] - Consulting the cradle for "/home/superfabio/projects/ride-rio/src/Tripper/Feature/Shared/Error.hs" Output from setting up the cradle Cradle {cradleRootDir = "/home/superfabio/projects/ride-rio", cradleOptsProg = CradleAction: Stack} 2020-09-09 18:27:53.9529617 [ThreadId 25] - Closed text document: file:///home/superfabio/projects/ride-rio/src/Tripper/Feature/Shared/Error.hs 2020-09-09 18:27:53.9977033 [ThreadId 25] - Opened text document: file:///home/superfabio/projects/ride-rio/src/Tripper/Feature/Shared/Types.hs 2020-09-09 18:27:54.8399421 [ThreadId 25] - Closed text document: file:///home/superfabio/projects/ride-rio/src/Tripper/Feature/Shared/Types.hs 2020-09-09 18:27:54.8720528 [ThreadId 25] - Opened text document: file:///home/superfabio/projects/ride-rio/src/Tripper/Feature/User/Server.hs > Using main module: 1. Package `tripper' component tripper:exe:tripper-exe with main-is file: /home/superfabio/projects/ride-rio/app/Main.hs > The following GHC options are incompatible with GHCi and have not been passed to it: -threaded > Configuring GHCi with the following packages: tripper > /home/superfabio/projects/ride-rio/.stack-work/install/x86_64-linux-nix/1e40d600a21178f87759f864a4596beae8df2fd811b0ed288be21955b37339bd/8.8.2/pkgdb:/home/superfabio/.stack/snapshots/x86_64-linux-nix/1e40d600a21178f87759f864a4596beae8df2fd811b0ed288be21955b37339bd/8.8.2/pkgdb:/nix/store/i70c2gjy0kzhfzbwfsbkhj9d9n61hb7p-ghc-8.8.2/lib/ghc-8.8.2/package.conf.d 2020-09-09 18:27:59.060296 [ThreadId 77] - Using interface files cache dir: /home/superfabio/.cache/ghcide/main-78a2e90bda2e3789e935afa855ae450410f41bf1 2020-09-09 18:27:59.060608 [ThreadId 77] - Making new HscEnv[main] 2020-09-09 18:27:59.144848 [ThreadId 256] - finish: CodeAction (took 0.00s) 2020-09-09 18:27:59.1457237 [ThreadId 265] - Data.HashMap.Internal.(!): key not found CallStack (from HasCallStack): error, called at ./Data/HashMap/Internal.hs:753:16 in unordered-containers-0.2.12.0-ee238bdcbdb407634d69853d9c1f729d7eeed23222d0def9f5d9e1b764c5d32e:Data.HashMap.Internal !, called at src/Development/IDE/Import/DependencyInformation.hs:107:40 in ghcide-0.2.0-inplace:Development.IDE.Import.DependencyInformation 2020-09-09 18:27:59.1459168 [ThreadId 265] - Data.HashMap.Internal.(!): key not found CallStack (from HasCallStack): error, called at ./Data/HashMap/Internal.hs:753:16 in unordered-containers-0.2.12.0-ee238bdcbdb407634d69853d9c1f729d7eeed23222d0def9f5d9e1b764c5d32e:Data.HashMap.Internal !, called at src/Development/IDE/Import/DependencyInformation.hs:107:40 in ghcide-0.2.0-inplace:Development.IDE.Import.DependencyInformation 2020-09-09 18:27:59.1493324 [ThreadId 314] - finish: CodeAction (took 0.00s) 2020-09-09 18:27:59.1496005 [ThreadId 314] - finish: CodeAction (took 0.00s) 2020-09-09 18:27:59.1498051 [ThreadId 314] - Data.HashMap.Internal.(!): key not found CallStack (from HasCallStack): error, called at ./Data/HashMap/Internal.hs:753:16 in unordered-containers-0.2.12.0-ee238bdcbdb407634d69853d9c1f729d7eeed23222d0def9f5d9e1b764c5d32e:Data.HashMap.Internal !, called at src/Development/IDE/Import/DependencyInformation.hs:107:40 in ghcide-0.2.0-inplace:Development.IDE.Import.DependencyInformation 2020-09-09 18:27:59.1499546 [ThreadId 314] - Data.HashMap.Internal.(!): key not found CallStack (from HasCallStack): error, called at ./Data/HashMap/Internal.hs:753:16 in unordered-containers-0.2.12.0-ee238bdcbdb407634d69853d9c1f729d7eeed23222d0def9f5d9e1b764c5d32e:Data.HashMap.Internal !, called at src/Development/IDE/Import/DependencyInformation.hs:107:40 in ghcide-0.2.0-inplace:Development.IDE.Import.DependencyInformation 2020-09-09 18:27:59.1501554 [ThreadId 314] - finish: CodeAction (took 0.00s) ```
jneira commented 4 years ago

Maybe it will be fixed with TH full support: https://github.com/haskell/ghcide/pull/836

fabioluz commented 4 years ago

That is merged already on ghcice repo. When can we expect it to be merged with HLS?

jneira commented 4 years ago

So we can assume the issue is fixed then, no? There is a open pr in hls but it needs some code change.

jneira commented 3 years ago

@fabioluz master (and the incoming 0.6 release) already includes the th improvements from ghcide, could you give a try?

fabioluz commented 3 years ago

@jneira It shows the same error.

haskell-language-server version: 0.6.0.0 (GHC: 8.8.4) (PATH: /home/superfabio/.vscode-server/data/User/globalStorage/haskell.haskell/haskell-language-server-0.6.0-linux-8.8.4) (GIT hash: 372a12e797069dc3ac4fa33dcaabe3b992999d7c)
Tool versions found on the $PATH
cabal:          Not found
stack:          2.5.1
ghc:            8.0.2
Debug output: ``` haskell-language-server version: 0.6.0.0 (GHC: 8.8.4) (PATH: /home/superfabio/.vscode-server/data/User/globalStorage/haskell.haskell/haskell-language-server-0.6.0-linux-8.8.4) (GIT hash: 372a12e797069dc3ac4fa33dcaabe3b992999d7c) (haskell-language-server)Ghcide setup tester in /home/superfabio/projects/ride-rio. Report bugs at https://github.com/haskell/haskell-language-server/issues Tool versions found on the $PATH cabal: Not found stack: 2.5.1 ghc: 8.0.2 Step 1/4: Finding files to test in /home/superfabio/projects/ride-rio Found 22 files Step 2/4: Looking for hie.yaml files that control setup Found 1 cradle Step 3/4: Initializing the IDE Step 4/4: Type checking the files [INFO] Consulting the cradle for "src/Tripper/Feature/User/Types.hs" NotShowMessage (NotificationMessage {_jsonrpc = "2.0", _method = WindowShowMessage, _params = ShowMessageParams {_xtype = MtInfo, _message = "No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for src/Tripper/Feature/User/Types.hs.\n Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).\nYou should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error."}}) Output from setting up the cradle Cradle {cradleRootDir = "/home/superfabio/projects/ride-rio", cradleOptsProg = CradleAction: Stack} > Configuring GHCi with the following packages: tripper > /home/superfabio/projects/ride-rio/.stack-work/install/x86_64-linux-nix/b6b26be2ab5ddc3ea2a69f3dde422efdcad1390890736a255b7f625eaf6c25c4/8.8.4/pkgdb:/home/superfabio/.stack/snapshots/x86_64-linux-nix/b6b26be2ab5ddc3ea2a69f3dde422efdcad1390890736a255b7f625eaf6c25c4/8.8.4/pkgdb:/nix/store/vydgrva7hyizaw8410ihmswk4b6mlbdj-ghc-8.8.4/lib/ghc-8.8.4/package.conf.d [INFO] Using interface files cache dir: /home/superfabio/.cache/ghcide/main-3f7da9e2746de5671f280ef0c8e69f389d54504e [INFO] Making new HscEnv[main] [INFO] Consulting the cradle for "app/Main.hs" NotShowMessage (NotificationMessage {_jsonrpc = "2.0", _method = WindowShowMessage, _params = ShowMessageParams {_xtype = MtInfo, _message = "No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for app/Main.hs.\n Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).\nYou should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error."}}) Output from setting up the cradle Cradle {cradleRootDir = "/home/superfabio/projects/ride-rio", cradleOptsProg = CradleAction: Stack} > Using main module: 1. Package `tripper' component tripper:exe:tripper-exe with main-is file: /home/superfabio/projects/ride-rio/app/Main.hs > The following GHC options are incompatible with GHCi and have not been passed to it: -threaded > Configuring GHCi with the following packages: tripper > /home/superfabio/projects/ride-rio/.stack-work/install/x86_64-linux-nix/b6b26be2ab5ddc3ea2a69f3dde422efdcad1390890736a255b7f625eaf6c25c4/8.8.4/pkgdb:/home/superfabio/.stack/snapshots/x86_64-linux-nix/b6b26be2ab5ddc3ea2a69f3dde422efdcad1390890736a255b7f625eaf6c25c4/8.8.4/pkgdb:/nix/store/vydgrva7hyizaw8410ihmswk4b6mlbdj-ghc-8.8.4/lib/ghc-8.8.4/package.conf.d [INFO] Using interface files cache dir: /home/superfabio/.cache/ghcide/main-af77bc68cce2e5bb3b3a88485a7a071e94a8919b [INFO] Using interface files cache dir: /home/superfabio/.cache/ghcide/main-af77bc68cce2e5bb3b3a88485a7a071e94a8919b [INFO] Making new HscEnv[main,main] [INFO] Consulting the cradle for "test/Spec.hs" NotShowMessage (NotificationMessage {_jsonrpc = "2.0", _method = WindowShowMessage, _params = ShowMessageParams {_xtype = MtInfo, _message = "No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for test/Spec.hs.\n Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).\nYou should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error."}}) Output from setting up the cradle Cradle {cradleRootDir = "/home/superfabio/projects/ride-rio", cradleOptsProg = CradleAction: Stack} > Using main module: 1. Package `tripper' component tripper:test:tripper-test with main-is file: /home/superfabio/projects/ride-rio/test/Spec.hs > tripper> configure (lib + test) > Configuring tripper-0.1.0.0... > tripper> initial-build-steps (lib + test) > tripper> Test running disabled by --no-run-tests flag. > Completed 2 action(s). > The following GHC options are incompatible with GHCi and have not been passed to it: -threaded > Configuring GHCi with the following packages: tripper > /home/superfabio/projects/ride-rio/.stack-work/install/x86_64-linux-nix/b6b26be2ab5ddc3ea2a69f3dde422efdcad1390890736a255b7f625eaf6c25c4/8.8.4/pkgdb:/home/superfabio/.stack/snapshots/x86_64-linux-nix/b6b26be2ab5ddc3ea2a69f3dde422efdcad1390890736a255b7f625eaf6c25c4/8.8.4/pkgdb:/nix/store/vydgrva7hyizaw8410ihmswk4b6mlbdj-ghc-8.8.4/lib/ghc-8.8.4/package.conf.d [INFO] Using interface files cache dir: /home/superfabio/.cache/ghcide/main-ed8fe86375185745446c941faef4060e29d9dd67 [INFO] Using interface files cache dir: /home/superfabio/.cache/ghcide/main-ed8fe86375185745446c941faef4060e29d9dd67 [INFO] Using interface files cache dir: /home/superfabio/.cache/ghcide/main-ed8fe86375185745446c941faef4060e29d9dd67 [INFO] Making new HscEnv[main,main,main] [INFO] Consulting the cradle for "Setup.hs" NotShowMessage (NotificationMessage {_jsonrpc = "2.0", _method = WindowShowMessage, _params = ShowMessageParams {_xtype = MtInfo, _message = "No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for Setup.hs.\n Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).\nYou should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error."}}) Output from setting up the cradle Cradle {cradleRootDir = "/home/superfabio/projects/ride-rio", cradleOptsProg = CradleAction: Stack} File: /home/superfabio/projects/ride-rio/Setup.hs Hidden: no Range: 1:1-2:1 Source: cradle Severity: DsError Message: Multi Cradle: No prefixes matched pwd: /home/superfabio/projects/ride-rio filepath: /home/superfabio/projects/ride-rio/Setup.hs prefixes: ("./src",Stack {component = Just "tripper:lib", stackYaml = Nothing}) ("./app/Main.hs",Stack {component = Just "tripper:exe:tripper-exe", stackYaml = Nothing}) ("./app/Paths_tripper.hs",Stack {component = Just "tripper:exe:tripper-exe", stackYaml = Nothing}) ("./test",Stack {component = Just "tripper:test:tripper-test", stackYaml = Nothing}) File: /home/superfabio/projects/ride-rio/.stack-work/dist/x86_64-linux-nix/Cabal-3.0.1.0/build/tripper-test/autogen/Paths_tripper.hs Hidden: no Range: 1:1-2:1 Source: compiler Severity: DsError Message: Data.HashMap.Internal.(!): key not found CallStack (from HasCallStack): error, called at ./Data/HashMap/Internal.hs:756:16 in unordered-containers-0.2.13.0-7bce3e274dd7297d74e25cb2728158d9c2d25d872a8e4caa6e4591d087253e77:Data.HashMap.Internal !, called at src/Development/IDE/Import/DependencyInformation.hs:108:40 in ghcide-0.5.0-inplace:Development.IDE.Import.DependencyInformation File: /home/superfabio/projects/ride-rio/src/Tripper/Feature/Translation/Server.hs Hidden: no Range: 7:1-7:16 Source: typecheck Severity: DsWarning Message: The import of ‘RIO.File’ is redundant except perhaps to import instances from ‘RIO.File’ To import instances alone, use: import RIO.File() File: /home/superfabio/projects/ride-rio/src/Tripper/Models.hs Hidden: no Range: 1:1-2:1 Source: typecheck Severity: DsError Message: Unexpected usage error /nix/store/kah5n342wz4i0s9lz9ka4bgz91xa2i94-glibc-2.32/lib/libc.so.6: symbol _dl_fatal_printf version GLIBC_PRIVATE not defined in file ld-linux-x86-64.so.2 with link time reference [INFO] finish: User TypeCheck (took 0.90s) Files that failed: * /home/superfabio/projects/ride-rio/Setup.hs * /home/superfabio/projects/ride-rio/src/Tripper/Main.hs * /home/superfabio/projects/ride-rio/src/Tripper/Models.hs * /home/superfabio/projects/ride-rio/src/Tripper/Server.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/Auth/Server.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/Auth/Types.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/Client/DB.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/Client/Server.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/User/DB.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/User/Server.hs * /home/superfabio/projects/ride-rio/src/Tripper/Feature/User/Types.hs Completed (11 files worked, 11 files failed) ```

I have this stand-alone ghc-8.0.2 on the $PATH, which was installed via apt-get. Is it possible it is causing issues?

jneira commented 3 years ago

I have this stand-alone ghc-8.0.2 on the $PATH, which was installed via apt-get. Is it possible it is causing issues?

Thanks for trying it. In theory it should not interfere with stack builds which uses only its own ghc (8.8.4 in your case). It is logged cause cabal uses by default the system default ghc

matobet commented 3 years ago

I'm also getting on all files that use TemplateHaskell:

Unexpected usage error
/nix/store/a6rnjp15qgp8a699dlffqj94hzy1nldg-glibc-2.32/lib/libc.so.6: symbol _dl_fatal_printf version GLIBC_PRIVATE not defined in file ld-linux-x86-64.so.2 with link time reference

With Haskell Language Server 0.6.0, GHC 8.8.4.

rubenmoor commented 3 years ago

I get the "Unexpected usage error" on

haskell-language-server version: 0.8.0.0 (GHC: 8.6.5)

on NixOS 20.09.2642.88f00e7e12d (Nightingale)

The files that fail have TemplateHaskell enabled.

Using the diagnostic mode I can extract the complete error message:

[INFO] Consulting the cradle for "reflex-platform/examples/WorkOnTest/Main.hs"
File:     /home/ruben/code/podcast/serendipity-platform/backend/src/Model.hs
Hidden:   no
Range:    1:1-2:1
Source:   typecheck
Severity: DsError
Message: 
  Unexpected usage error
  can't load .so/.DLL for: /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/librt.so
  (/nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/librt.so: undefined symbol:
  __clock_nanosleep, version GLIBC_PRIVATE)
File:     /home/ruben/code/podcast/serendipity-platform/frontend/src/Main.hs
Hidden:   no
Range:    1:1-2:1
Source:   typecheck
Severity: DsError
Message: 
  Unexpected usage error
  can't load .so/.DLL for: /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/librt.so
  (/nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/librt.so: undefined symbol:
  __clock_nanosleep, version GLIBC_PRIVATE)

Also, as a workaround, I switched to GHC 8.10.2 where everything works fine with haskell-language-server, same 0.8.0.0 version.

(This workaround comes at a price, though. reflex-platform and reflex-dom specifically do not support anything above GHC 8.6.5)

EDIT: for completeness sake: Moving to GHC 8.10.2 solved the issue together with a workaround regarding filepaths (cf. https://github.com/haskell/haskell-language-server/issues/481#issuecomment-737775878)

santiweight commented 3 years ago

I cannot currently give a more full diagnosis, but I will say I am interested in this bug being fixed. Hls is failing in a TemplateHaskell file on 0.8.0.0 with GHC 8.6.5. I am using reflex-dom on nix and so I am unable to switch to a newer version of GHC.

santiweight commented 3 years ago

Heads up:

This issue arises when using an HLS binary in a project that was not compiled with the same GHC binary that is being used to compile the project. I'm assuming that this is reason for the badly-linked glibc. My issue arose from running an HLS binary in an Obelisk and but failing to compile my HLS binary in nix-shell. This occurred _eventhough the two binaries were both GHC-8.6.5, which is extremely frustrating of course.

I don't know of a good workaround currently sadly - the actual way to fix this is to add a haskell-language-server derivation to your nix environment. My quickfix was to hop into nix-shell and go back 100 commits at a time from hls's repo's head until hls compiled (for me at HEAD in an obelisk project, this was ^100).

Some related work for those looking for a more permanent solution: A PR for hls binary to be shipped with reflex-platform A comment sharing a sample config that fixed the issue in this github issue. A _BIGHIGHLIGHT of a repo with extensive docs on how to use hls with any nix environment and nix derivation to boot. This repo appears to only be compatible with Haskell.nix which is a shame but at least it can be a basis for fixes that can be used in reflex/Obsidian et al. The docs here are also invaluable as a nix-noob (which I am).

Also, the article that explicitly warned me.

jneira commented 2 years ago

I am gonna close this issue as all compiler crashes seems to have the same root cause:

If any of you think the issue should not be included generically feel free to reopen it (with a brief explanation if possible) Thanks all!