-
-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Statically linked Linux binaries cannot run interactive session #221
Comments
Please attach the full log to see if it's something obvious. |
The full log from start of VisualCode + hls:
Repository with the simplest project allowing me to reproduce this issue: https://github.com/paweln1986/eval-issue |
Thanks for the test repo, that really helps $ ls ~/.stack/programs/x86_64-osx/
ghc-8.10.1 ghc-8.2.2 ghc-8.6.5 ghc-8.8.2 ghc-8.8.3
ghc-8.10.1.installed ghc-8.2.2.installed ghc-8.6.5.installed ghc-8.8.2.installed ghc-8.8.3.installed
ghc-8.10.1.tar.bz2 ghc-8.2.2.tar.bz2 ghc-8.6.5.tar.bz2 ghc-8.8.2.tar.bz2 ghc-8.8.3.tar.bz2 If you don't mind rebuilding/redownloading stuff, could you try deleting |
Unfortunately after removing |
I'm just noticing now that your logs are downloading ghc-8.8.2, but the project's snapshot lts-16.6 should be ghc-8.8.3. Do other features work like error diagnostics and document symbols? |
Also can you post the output of running
in the project directory, just to make sure the project ghc version detection isn't doing anything weird |
This. The haskell-language-server binary needs to be compiled by the same ghc installation used to build the project. How did you install Haskell-language-server? |
@pepeiborra looks like through the automatic download given the location of the binaries |
The difference of the GHC version in those two logs is because I bumped the version of stack resolver to verify if this issue is related to GHC version.
Binary of HLS was automatically installed by VSCode plugin. {-# LANGUAGE TemplateHaskell #-}
module Lib
( someFunc
) where
someFunc :: IO ()
someFunc = putStrLn "someFunc"
|
Commenting here since I think it's specifically the same issue and nothing to do with the vscode extension. From the other issue: Details
Steps takenCleaned out all of ghc and stack and existing haskell binaries and reinstalled everything with the same result. Error:After letting the extension load I get "problems" on 11 random files with {
"resource": "/home/user/projects/work-project/library/some/foo/Bar.hs",
"owner": "Haskell (work-project)",
"severity": 8,
"message": "Installation error: unable to load package `ghc-prim-0.5.3'",
"source": "typecheck",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 2,
"endColumn": 1
} Extension output:[client] run command: "/home/user/.vscode-server/data/User/globalStorage/alanz.vscode-hie-server/haskell-language-server-0.2.1-linux-8.8.3 --lsp"
[client] debug command: "/home/user/.vscode-server/data/User/globalStorage/alanz.vscode-hie-server/haskell-language-server-0.2.1-linux-8.8.3 --lsp"
[client] server cwd: undefined
haskell-language-server version: 0.2.1.0 (GHC: 8.8.3) (PATH: /home/user/.vscode-server/data/User/globalStorage/alanz.vscode-hie-server/haskell-language-server-0.2.1-linux-8.8.3) (GIT hash: e8812c18d2be311c6b52545a0dc2b1408f8fa4b2)
Starting (haskell-language-server)LSP server...
with arguments: Arguments {argLSP = True, argsCwd = Nothing, argFiles = [], argsVersion = False, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
with plugins: [PluginId "eval",PluginId "floskell",PluginId "ghcide",PluginId "ormolu",PluginId "pragmas",PluginId "stylish-haskell"]
in directory: /home/user/projects/work-project
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
Started LSP server in 0.02s
2020-07-24 17:25:51.690812281 [ThreadId 21] - Opened text document: file:///home/user/projects/work-project/library/Action/Action.hs
Data.HashMap.Base.(!): key not found
CallStack (from HasCallStack):
error, called at ./Data/HashMap/Base.hs:733:16 in unordered-containers-0.2.11.0-fad0aad3e3deab0594b70513441a5eef969fad7c39bde432b7beca5a0ea273f2:Data.HashMap.Base
!, called at src/Development/IDE/Import/DependencyInformation.hs:107:40 in ghcide-0.2.0-inplace:Development.IDE.Import.DependencyInformation
2020-07-24 17:25:51.692437351 [ThreadId 63] - Consulting the cradle for "/home/user/projects/work-project/library/Action/Action.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/home/user/projects/work-project", cradleOptsProg = CradleAction: Stack}
[Error - 5:25:51 PM] haskell-lsp:configuration parse error. NotificationMessage {_jsonrpc = "2.0", _method = WorkspaceDidChangeConfiguration, _params = DidChangeConfigurationParams {_settings = Object (fromList [("haskell",Object (fromList [("logFile",String ""),("hlintOn",Bool True),("formatOnImportOn",Bool True),("enable",Bool True),("indentationRules",Object (fromList [("enabled",Bool False)])),("liquidOn",Bool False),("languageServerVariant",String "haskell-language-server"),("serverExecutablePath",String ""),("diagnosticsOnChange",Bool True),("completionSnippetsOn",Bool True),("maxNumberOfProblems",Number 100.0),("formattingProvider",String "brittany"),("trace",Object (fromList [("server",String "off")]))]))])}} "key \"languageServerHaskell\" not found"
> Configuring GHCi with the following packages: work-project
> /home/user/projects/work-project/.stack-work/install/x86_64-linux-tinfo6/3ea20d7672e8fbf87f04e1a3aaf2eadc7ca2fa7f104aac50f76a9bb8664b27ff/8.8.3/pkgdb:/home/user/.stack/snapshots/x86_64-linux-tinfo6/3ea20d7672e8fbf87f04e1a3aaf2eadc7ca2fa7f104aac50f76a9bb8664b27ff/8.8.3/pkgdb:/home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/package.conf.d
2020-07-24 17:26:09.290541153 [ThreadId 63] - Using interface files cache dir: /home/user/.cache/ghcide/main-1071c4a8018389024d51dabf6a57567030682bc3
2020-07-24 17:26:09.290977919 [ThreadId 63] - Making new HscEnv[main]
2020-07-24 17:26:12.174854595 [ThreadId 144] - finish: CodeAction (took 0.00s)
2020-07-24 17:26:14.017539293 [ThreadId 7831] - finish: CodeAction:PackageExports (took 1.84s)
2020-07-24 17:26:14.017718205 [ThreadId 7834] - Plugin.makeCodeLens (ideLogger)
haskell-language-server-0.2.1-linux-8.8.3: /home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/HSghc-prim-0.5.3.o: unknown symbol `exp'
haskell-language-server-0.2.1-linux-8.8.3: /home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/HSghc-prim-0.5.3.o: unknown symbol `exp'
haskell-language-server-0.2.1-linux-8.8.3: /home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/HSghc-prim-0.5.3.o: unknown symbol `exp'
haskell-language-server-0.2.1-linux-8.8.3: /home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/HSghc-prim-0.5.3.o: unknown symbol `exp'
haskell-language-server-0.2.1-linux-8.8.3: /home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/HSghc-prim-0.5.3.o: unknown symbol `exp'
haskell-language-server-0.2.1-linux-8.8.3: /home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/HSghc-prim-0.5.3.o: unknown symbol `exp'
haskell-language-server-0.2.1-linux-8.8.3: /home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/HSghc-prim-0.5.3.o: unknown symbol `exp'
haskell-language-server-0.2.1-linux-8.8.3: /home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/HSghc-prim-0.5.3.o: unknown symbol `exp'
haskell-language-server-0.2.1-linux-8.8.3: /home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/HSghc-prim-0.5.3.o: unknown symbol `exp'
haskell-language-server-0.2.1-linux-8.8.3: /home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/HSghc-prim-0.5.3.o: unknown symbol `exp'
haskell-language-server-0.2.1-linux-8.8.3: /home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/HSghc-prim-0.5.3.o: unknown symbol `exp'
2020-07-24 17:26:31.982351492 [ThreadId 25303] - finish: codeLens (took 17.96s)
2020-07-24 17:26:31.982836488 [ThreadId 25306] - GhcIde.hover entered (ideLogger)
2020-07-24 17:26:31.982929292 [ThreadId 25306] - Hover request at position 18:27 in file: /home/user/projects/work-project/library/Action/Action.hs Manual HLS output:Running HLS manually I get something similar: (some stuff redacted, removed repetive errors) > ~/.vscode-server/data/User/globalStorage/alanz.vscode-hie-server/haskell-language-server-0.2.1-linux-8.8.3
haskell-language-server version: 0.2.1.0 (GHC: 8.8.3) (PATH: ~/.vscode-server/data/User/globalStorage/alanz.vscode-hie-server/haskell-language-server-0.2.1-linux-8.8.3) (GIT hash: e8812c18d2be311c6b52545a0dc2b1408f8fa4b2)
(haskell-language-server)Ghcide setup tester in ~/projects/foo-project.
Report bugs at https://github.com/haskell/haskell-language-server/issues
Step 1/4: Finding files to test in ~/projects/foo-project
Found 1222 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 "~/projects/foo-project/library/redacted.hs"
Output from setting up the cradle Cradle {cradleRootDir = "~/projects/foo-project", cradleOptsProg = CradleAction: Stack}
> Configuring GHCi with the following packages: foo-project
> ~/projects/foo-project/.stack-work/install/x86_64-linux-tinfo6/3ea20d7672e8fbf87f04e1a3aaf2eadc7ca2fa7f104aac50f76a9bb8664b27ff/8.8.3/pkgdb:~/.stack/snapshots/x86_64-linux-tinfo6/3ea20d7672e8fbf87f04e1a3aaf2eadc7ca2fa7f104aac50f76a9bb8664b27ff/8.8.3/pkgdb:~/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/package.conf.d
[INFO] Using interface files cache dir: ~/.cache/ghcide/main-1071c4a8018389024d51dabf6a57567030682bc3
[INFO] Making new HscEnv[main]
[INFO] Consulting the cradle for "~/projects/foo-project/test/redacted.hs"
Output from setting up the cradle Cradle {cradleRootDir = "~/projects/foo-project", cradleOptsProg = CradleAction: Stack}
> Using main module: 1. Package `foo-project' component foo-project:test:test with main-is file: ~/projects/foo-project/test/redacted.hs
> The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
> Configuring GHCi with the following packages: foo-project
> ~/projects/foo-project/.stack-work/install/x86_64-linux-tinfo6/3ea20d7672e8fbf87f04e1a3aaf2eadc7ca2fa7f104aac50f76a9bb8664b27ff/8.8.3/pkgdb:~/.stack/snapshots/x86_64-linux-tinfo6/3ea20d7672e8fbf87f04e1a3aaf2eadc7ca2fa7f104aac50f76a9bb8664b27ff/8.8.3/pkgdb:~/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/package.conf.d
[INFO] Using interface files cache dir: ~/.cache/ghcide/main-000d2ed3b3c7c55de3530c0d2fa463028e71420f
[INFO] Using interface files cache dir: ~/.cache/ghcide/main-000d2ed3b3c7c55de3530c0d2fa463028e71420f
[INFO] Making new HscEnv[main,main]
[INFO] Consulting the cradle for "~/projects/foo-project/executable/Main.hs"
Output from setting up the cradle Cradle {cradleRootDir = "~/projects/foo-project", cradleOptsProg = CradleAction: Stack}
> Using main module: 1. Package `foo-project' component foo-project:exe:foo-project with main-is file: ~/projects/foo-project/executable/Main.hs
> The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
> Configuring GHCi with the following packages: foo-project
> ~/projects/foo-project/.stack-work/install/x86_64-linux-tinfo6/3ea20d7672e8fbf87f04e1a3aaf2eadc7ca2fa7f104aac50f76a9bb8664b27ff/8.8.3/pkgdb:~/.stack/snapshots/x86_64-linux-tinfo6/3ea20d7672e8fbf87f04e1a3aaf2eadc7ca2fa7f104aac50f76a9bb8664b27ff/8.8.3/pkgdb:~/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/package.conf.d
[INFO] Using interface files cache dir: ~/.cache/ghcide/main-2d85e50b6f3e807fffe1f3b49a55125f752fe07e
[INFO] Using interface files cache dir: ~/.cache/ghcide/main-2d85e50b6f3e807fffe1f3b49a55125f752fe07e
[INFO] Using interface files cache dir: ~/.cache/ghcide/main-2d85e50b6f3e807fffe1f3b49a55125f752fe07e
[INFO] Making new HscEnv[main,main,main]
[INFO] Consulting the cradle for "~/projects/foo-project/tools/docker/hasktags-daemon.hs"
Output from setting up the cradle Cradle {cradleRootDir = "~/projects/foo-project", cradleOptsProg = CradleAction: Stack}
File: ~/projects/foo-project/tools/docker/hasktags-daemon.hs
Hidden: no
Range: 1:0-2:0
Source: cradle
Severity: DsError
Message:
Multi Cradle: No prefixes matched
pwd: ~/projects/foo-project
filepath: ~/projects/foo-project/tools/docker/hasktags-daemon.hs
prefixes:
("./library",Stack {component = Just "foo-project:lib"})
("./executable/Main.hs",Stack {component = Just "foo-project:exe:foo-project"})
("./test",Stack {component = Just "foo-project:test:test"})
File: ~/projects/foo-project/test/redacted.hs
Hidden: no
Range: 1:0-2:0
Source: compiler
Severity: DsError
Message: haskell-language-server-0.2.1-linux-8.8.3: could not execute: hspec-discover
[INFO] Consulting the cradle for "~/projects/foo-project/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/autogen/Paths_foo-project.hs"
Output from setting up the cradle Cradle {cradleRootDir = "~/projects/foo-project", cradleOptsProg = CradleAction: Stack}
File:
~/projects/foo-project/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/autogen/Paths_foo-project.hs
Hidden: no
Range: 1:0-2:0
Source: cradle
Severity: DsError
Message:
Multi Cradle: No prefixes matched
pwd: ~/projects/foo-project
filepath:
~/projects/foo-project/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/autogen/Paths_foo-project.hs
prefixes:
("./library",Stack {component = Just "foo-project:lib"})
("./executable/Main.hs",Stack {component = Just "foo-project:exe:foo-project"})
("./test",Stack {component = Just "foo-project:test:test"})
haskell-language-server-0.2.1-linux-8.8.3: ~/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/ghc-prim-0.5.3/HSghc-prim-0.5.3.o: unknown symbol `exp'
File:
~/projects/foo-project/library/redacted.hs
Hidden: no
Range: 1:0-2:0
Source: typecheck
Severity: DsError
Message: Installation error: unable to load package `ghc-prim-0.5.3'
...
[INFO] finish: User TypeCheck (took 54.21s)
Files that failed:
* ~/projects/foo-project/library/redacted.hs
...
Completed (701 files worked, 521 files failed) |
I can reproduce similar result using Yesod project template. Ubuntu 20.04
|
Noticed the same thing with hlint. (Ubuntu 20.04, GHC 8.10.1, Cabal 3.2.0.0)
|
On macOS with the 0.2.1 binary the yesod project template segfaults, with a separate issue not-related to ghc-prim:
|
I'm hitting this on a fresh install via the VScode extension when opening a file containing Template Haskell. GHC 8.10.1. Ubuntu 16. Everything was working fine with my previous locally-built version (from the HEAD of the Fourmolu branch), but I had to upgrade due to the settings name mismatch issue. |
I can confirm this issue persist only with binary downloaded by VSCode extension. If I build HLS from source, eval plugin works as expected. |
I can only imagine
|
Maybe statically linking to glibc (which libm is part of) is the culprit? Also see this comment on /r/haskell. |
@amesgen I'm going to try building hls inside ghc-musl and see what happens |
I have a binary built with ghc-musl now, but unfortunately the ghc-prim issue still persists with it |
The current fix it looks like is to dynamically load |
It is worth noting that this trick does not work when statically linked with |
Building binaries with |
@bubba happy to test (had this error). How exactly should that be done? Previously I had an error when just trying to make VSCode do all the job (setup etc.), I assume something extra needs to be done for it to use the tag. |
It fixed the issue on my machine. 🎉 |
I tried the new binary and it looks like hls gets stuck at 100% cpu while loading some files. Not sure if it's related to my project though, when I have some time I'll attempt to run it on a simpler project. |
@k-bx if you head to the release page and download the corresponding haskell-language-server-Linux for whatever GHC version your project was using, decompress that and then go into the VSCode settings. Search for Haskell server path and set that path to the decompressed binary, then reload VS Code. Try opening up a file with template Haskell or using the eval plugin. If anything goes wrong can you upload the contents from the output window > Haskell tab? |
@bubba thank you for the instructions! It now launched indeed but seems to be hanging in this "Processing: 45/68" state eating 100% of one CPU, similar to an aforementioned problem. UPDATE: found it (needed to choose the dropdown on the right): https://gist.github.com/k-bx/b92edee5542f05f35b7652e626c0d34c |
So @aschmois and I are working with the same codebase. I thought the problem is that we have a 13GB .docker folder that's being slurped up in the expandFiles function in the initialization at the beginning here. But I see it's ignoring hidden directories in it's definition:
Edit: I tried looking into this further, but got hung up by #294 |
Adding
Testing this workaround is much appreciated! (btw, |
@k-bx well I can't see the ghc-prim error in the log so looks like that's one problem solved! If you haven't built the project before with cabal/stack it may take some time depending on the size as it builds dependencies etc. It might be a good idea to call |
EnvironmentSystem: Archlinux ScreenshotThe error message will hover above the first extension, and functionalities provided by hls are no longer avaliable. Vscode output
Directly run
|
Fixes the issue for me as well, thanks! |
Yes indeed, seems like it's a different problem now. Re building project – no, it builds fine with |
@k-bx can you open a new issue for your case? Also are you able to share the project that this is happening on? |
@bubba the project happens to be open-source already https://github.com/k-bx/emotive_conjugations I'll try to find some time to make a proper issue, thanks! |
I'm still getting a similar error in files using template haskell. This is using vscode inside a nix shell and version 0.4.0 of HLS downloaded by the vscode plugin:
|
@polux I had the same problem. I got HLS to find libm by putting glibc on my LD_LIBRARY_PATH using a let
pkgs =
import <nixpkgs> { };
in
(import ./.).shellFor {
packages = ps: [ ps.cubix ];
exactDeps = true;
tools.cabal = "3.2.0.0";
shellHook = ''
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${pkgs.glibc}/lib
'';
} |
@puffnfresh thanks! Unfortunately in my case this leads to a segfault when I launch vscode downloaded from https://code.visualstudio.com/. If I try to install my nixpkg's vscode then I get an old version which is not compatible with the haskell extension. If I install |
I encountered an issue using evaluate comment functionality with message
unable to load package
ghc-prim-0.5.3'`.hls version - 0.2.1
stack version - 2.3.1
Am I missing something?
The text was updated successfully, but these errors were encountered: