Cannot load -dynamic objects (hie-8.6.5) #1433
Description
This other issue addresses a similar error but it was not answered #1101.
TL;DR: Check the Actual behaviour
section
Installing & GHC versions
I fresh installed the hie for 8.6.5
using stack ./install.hs stack-hie-8.6.5
. My project is using lts-13.21
which sets the GHC version to 8.6.5
.
Project structure
Global
My project structure is as follows:
.
├── a
│ ├── app
│ ├── package.yaml
│ ├── Setup.hs
│ ├── src
│ └── stack.yaml
├── b
│ ├── package.yaml
│ ├── Setup.hs
│ ├── src
│ └── stack.yaml
├── c
│ ├── package.yaml
│ ├── Setup.hs
│ ├── src
│ └── stack.yaml
└── stack.yaml
Then stack.yaml
specifies:
packages:
- a
- b
- c
A
a/stack.yaml
specifies:
packages:
- .
B
b/stack.yaml
specifies:
packages:
- .
extra-deps:
- ../a/
Followed by a declaration on b/package.yaml
:
dependencies:
- a
C
and c/stack.yaml
specifies:
packages:
- .
extra-deps:
- ../a/
- ../b/
Followed by a declaration on c/package.yaml
:
dependencies:
- a
- b
Editor
I am using Emacs with lsp-mode
, lsp-ui
, treemacs
, lsp-treemacs
(I also use Rust and all of this is working nicely, no issues at all) and lsp-haskell
. I also use haskell-mode
and intero
which I guess should work fine, as they work fine if I don't activate lsp-haskell
They are all recently installed/updated so there are no outdated versions installed.
I have also tried in VS Code with the same error output.
Expected behaviour
I would expect the hie lsp server to start nicely.
Actual behaviour
The very moment I open a haskell file I get one of these two messages:
LSP :: Got error while processing diagnostics: src/Lib.hs:1:1: fatal:
Cannot load -dynamic objects when GHC is built the normal way
To fix this, either:
(1) Use -fexternal-interpreter, or
(2) Build the program twice: once the normal way, and then
with -dynamic using -osuf to set a different object file suffix.
or
Couldn't satisfy -package-id a-<random-hash>
Running it directly
If I run hie-wrapper
both in the project root and in c/
, it starts nicely:
javier@Javier-Workstation ~/ hie-wrapper
2019-11-04 15:16:09.563716995 [ThreadId 4] - run entered for hie-wrapper(hie-wrapper) Version 0.13.0.0, Git revision 7cf1295a2804a527381331bb7b73d58255721edc (3051 commits) x86_64 ghc-8.6.5
2019-11-04 15:16:09.566838585 [ThreadId 4] - Current directory:/home/javier/project
2019-11-04 15:16:09.567888035 [ThreadId 4] - Operating system:linux
2019-11-04 15:16:09.570729931 [ThreadId 4] - Cradle directory:/home/javier/project
2019-11-04 15:16:09.570937925 [ThreadId 4] - Using stack GHC version
2019-11-04 15:16:09.733335887 [ThreadId 4] - Project GHC version:8.6.5
2019-11-04 15:16:09.733508678 [ThreadId 4] - hie exe candidates :["hie-8.6.5","hie-8.6","hie"]
2019-11-04 15:16:09.733786427 [ThreadId 4] - found hie exe at:/home/javier/.local/bin/hie-8.6.5
2019-11-04 15:16:09.733951666 [ThreadId 4] - args:[]
2019-11-04 15:16:09.734060731 [ThreadId 4] - launching ....
2019-11-04 15:16:09.735337688 [ThreadId 4] - Using stack GHC version
2019-11-04 15:16:09.90009249 [ThreadId 4] - Run entered for HIE(hie-8.6.5) Version 0.13.0.0, Git revision 7cf1295a2804a527381331bb7b73d58255721edc (3051 commits) x86_64 ghc-8.6.5
2019-11-04 15:16:09.900571282 [ThreadId 4] - Current directory:/home/javier/project
2019-11-04 15:16:09.900758684 [ThreadId 4] - args:[]
^Cuser interrupt
hie-wrapper: callProcess: /home/javier/.local/bin/hie-8.6.5 (exit 1): failed
✘ javier@Javier-Workstation ~/ cd c
javier@Javier-Workstation ~/c hie-wrapper
2019-11-04 15:16:16.026020944 [ThreadId 4] - run entered for hie-wrapper(hie-wrapper) Version 0.13.0.0, Git revision 7cf1295a2804a527381331bb7b73d58255721edc (3051 commits) x86_64 ghc-8.6.5
2019-11-04 15:16:16.027281796 [ThreadId 4] - Current directory:/home/javier/project/c
2019-11-04 15:16:16.027778145 [ThreadId 4] - Operating system:linux
2019-11-04 15:16:16.341402984 [ThreadId 4] - Cradle directory:/home/javier/project/c
2019-11-04 15:16:16.341923057 [ThreadId 4] - Using stack GHC version
2019-11-04 15:16:16.506474309 [ThreadId 4] - Project GHC version:8.6.5
2019-11-04 15:16:16.506646263 [ThreadId 4] - hie exe candidates :["hie-8.6.5","hie-8.6","hie"]
2019-11-04 15:16:16.506914166 [ThreadId 4] - found hie exe at:/home/javier/.local/bin/hie-8.6.5
2019-11-04 15:16:16.507066794 [ThreadId 4] - args:[]
2019-11-04 15:16:16.507166858 [ThreadId 4] - launching ....
2019-11-04 15:16:16.50833484 [ThreadId 4] - Using stack GHC version
2019-11-04 15:16:16.67503773 [ThreadId 4] - Run entered for HIE(hie-8.6.5) Version 0.13.0.0, Git revision 7cf1295a2804a527381331bb7b73d58255721edc (3051 commits) x86_64 ghc-8.6.5
2019-11-04 15:16:16.675573273 [ThreadId 4] - Current directory:/home/javier/project/c
2019-11-04 15:16:16.675810275 [ThreadId 4] - args:[]
Questions
- I don't know where to put the
settings.json
file if it is even needed. - It says I should recompile the program dynamically again but which program? HIE or my project one?
- Why can't it find a dependency that is specified in
stack.yaml
file?