Closed fabioluz closed 2 years ago
Maybe it will be fixed with TH full support: https://github.com/haskell/ghcide/pull/836
That is merged already on ghcice repo. When can we expect it to be merged with HLS?
So we can assume the issue is fixed then, no? There is a open pr in hls but it needs some code change.
@fabioluz master (and the incoming 0.6 release) already includes the th improvements from ghcide, could you give a try?
@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
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?
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
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.
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)
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.
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).
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!
Subject of the issue
Module with TH code used for generating Persistent entities shows the following error:
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
Output of
haskell-language-server --probe-tools
orhaskell-language-server-wrapper --probe-tools
Which lsp-client do you use
Describe your project https://github.com/fabioluz/tripper - be aware it uses nix. If you don't have nix, it might take a bit to compile the first time.
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) ```