Skip to content

GHCIDE fails in quasi-quote expressions (cannot find symbols) #905

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

Closed
fabioluz opened this issue May 24, 2020 · 5 comments
Closed

GHCIDE fails in quasi-quote expressions (cannot find symbols) #905

fabioluz opened this issue May 24, 2020 · 5 comments

Comments

@fabioluz
Copy link

Hi, I have an issue very similar to #787 and haskell/ghcide#425. I didn't understand the proposed solutions for them.

I'm using the library persistent-template and GHCIDE fails in recognizing a quasi-quote expression, showing the following error message:

Program error: 
ByteCodeLink.lookupCE
During interactive linking, GHCi couldn't find the following symbol:
  RideziSharedziTypes_Email_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session.  Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.

In #787, it says that adding add executable-dynamic: True to the cabal.project fixed the issue. I don't have a cabal.project, I'm using stack. I have a package.yaml and project.cabal. I tried adding add executable-dynamic: True project.cabal but it made no difference.

I also tried adding -dynamic to the ghc-options in package.yaml. After that the error message changed to:

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.

In haskell/ghcide#425, it says: It turns out the issue is that ghcide must be build dynamically, instead of the default static.

How do I do that? I installed GHCIDE with Nix, following the instructions in the repository. Should I download the source code, change something and build it manually in this case?

Thanks in advance.

@mpickering
Copy link
Contributor

I think this is fixed if you build from master. Try that?

@fabioluz
Copy link
Author

fabioluz commented May 24, 2020

Ok. I can do that but I need some guidance 😆 .

I just cloned from master, I see the project uses nightly-2019-09-16 which is ghc-8.6.5. My project uses ghc-8.8.3. What do I have to change to build ghcide in the same ghc version my project uses? Can I just change ghcide stack.yaml to the same resolver I'm using?

@cocreature
Copy link
Contributor

Can I just change ghcide stack.yaml to the same resolver I'm using?

Yes, that should work.

@fabioluz
Copy link
Author

fabioluz commented May 24, 2020

stack install always throws an error. I tried changing the resolver to lts-15.12 as well as using the stack88.yaml file. I get this error:

hie-bios   > [ 1 of 16] Compiling HIE.Bios.Config
ghc-check  > /usr/bin/ld.gold: error: cannot find -ltinfo
ghc-check  > collect2: error: ld returned 1 exit status
ghc-check  > `gcc' failed in phase `Linker'. (Exit code: 1)
haskell-lsp> [3 of 8] Compiling Language.Haskell.LSP.Messages
hie-bios   > [ 2 of 16] Compiling HIE.Bios.Ghc.Gap
hie-bios   > [ 3 of 16] Compiling HIE.Bios.Ghc.Doc
hie-bios   > [ 4 of 16] Compiling HIE.Bios.Internal.Log
hie-bios   > [ 5 of 16] Compiling HIE.Bios.Ghc.Load
hie-bios   > [ 6 of 16] Compiling HIE.Bios.Types
hie-bios   > [ 7 of 16] Compiling HIE.Bios.Flags
hie-bios   > [ 8 of 16] Compiling HIE.Bios.Environment
hie-bios   > [ 9 of 16] Compiling HIE.Bios.Ghc.Api
hie-bios   > [10 of 16] Compiling HIE.Bios.Ghc.Logger
hie-bios   > [11 of 16] Compiling HIE.Bios.Ghc.Check
hie-bios   > [12 of 16] Compiling HIE.Bios.Wrappers
hie-bios   > <command line>: can't load .so/.DLL for: libtinfo.so (libtinfo.so: cannot open shared object file: No such file or directory)
haskell-lsp> [4 of 8] Compiling Language.Haskell.LSP.Capture
haskell-lsp> [5 of 8] Compiling Language.Haskell.LSP.Utility
haskell-lsp> [6 of 8] Compiling Language.Haskell.LSP.VFS
haskell-lsp> [7 of 8] Compiling Language.Haskell.LSP.Core
haskell-lsp> [8 of 8] Compiling Language.Haskell.LSP.Control
haskell-lsp> copy/register
haskell-lsp> Installing library in /home/superfabio/.stack/snapshots/x86_64-linux/96d253000bc77d3f1c6c6e354b5b0a8f15db5503e6072c0eedd2735128e7232e/8.6.5/lib/x86_64-linux-ghc-8.6.5/haskell-lsp-0.22.0.0-KAahzmv3DQo66KJTWcD2Gs
haskell-lsp> Registering library for haskell-lsp-0.22.0.0..

--  While building package hie-bios-0.5.0 using:
      /home/superfabio/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1


--  While building package ghc-check-0.3.0.1 using:
      /home/superfabio/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

EDIT: I could get more info when scrolling up the error.

Any ideas of what it could be?

@fabioluz
Copy link
Author

The problem was that I didn't have ghc as stand-alone installation, so running apt-get install ghc ghc-prof ghc-doc solved that.

After installing ghcide from master, the issue was gone, so it was indeed fixed 👍

Thank you!

@pepeiborra pepeiborra transferred this issue from haskell/ghcide Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants