Skip to content

Error from any file: this operation requires -fexternal-interpreter #2975

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
maksbotan opened this issue Jun 20, 2022 · 7 comments
Closed

Error from any file: this operation requires -fexternal-interpreter #2975

maksbotan opened this issue Jun 20, 2022 · 7 comments
Labels
status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@maksbotan
Copy link
Contributor

Your environment

Which OS do you use:
macOS 11.6 Bug Sur
Which LSP client (editor/plugin) do you use:
neovim + coc.nvim, vs code
Describe your project (alternative: link to the project):
cabal.project + hie.yaml, https://github.com/biocad/cobot-io

Steps to reproduce

I have GHC 8.10.7 from haskell.nix and haskell-language-server 1.7.0.0 built from Hackage with cabal with this patch applied to ghcide: https://github.com/input-output-hk/haskell.nix/blob/master/patches/ghcide-1.7-unboxed-tuple-fix-issue-1455.patch

Expected behaviour

Should work

Actual behaviour

Each file gets this diagnostics:

Message:  haskell-language-server: this operation requires -fexternal-interpreter

And nothing works. Adding -fexternal-interpreter to library's ghc-options does not help.

Include debug information

$ haskell-language-server --probe-tools
2022-06-20T13:22:48.598322Z | Info | No log file specified; using stderr.
haskell-language-server version: 1.7.0.0 (GHC: 8.10.7) (PATH: /nix/store/hzj3v8zmwxih2g1agjxna045lzlq6ffq-haskell-language-server-exe-haskell-language-server-1.7.0.0/bin/haskell-language-server)
Tool versions found on the $PATH
cabal:		3.6.2.0
stack:		2.7.5
ghc:		8.10.7
$ haskell-language-server --print-cradle
2022-06-20T13:23:14.499544Z | Info | No log file specified; using stderr.
Cradle {cradleRootDir = "/Users/maksbotan/biocad/cobot-io", cradleOptsProg = CradleAction: Cabal}

Snippet from haskell-language-server --debug from console:

2022-06-20 16:14:57.461045 [ThreadId 887] INFO hie-bios:	[44 of 44] Compiling Paths_cobot_io   ( /Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/build/autogen/Paths_cobot_io.hs, /Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/build/Paths_cobot_io.o, /Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/build/Paths_cobot_io.dyn_o )
2022-06-20 16:14:58.9091 [ThreadId 887] INFO hie-bios:	Configuring test suite 'cobot-io-test' for cobot-io-0.1.4.4..
2022-06-20 16:15:00.845501 [ThreadId 887] INFO hie-bios:	Preprocessing test suite 'cobot-io-test' for cobot-io-0.1.4.4..
2022-06-20T13:15:01.579573Z | Debug | Session loading result: Right (ComponentOptions {componentOptions = ["-fbuilding-cabal-package","-O0","-outputdir","/Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/t/cobot-io-test/build/cobot-io-test/cobot-io-test-tmp","-odir","/Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/t/cobot-io-test/build/cobot-io-test/cobot-io-test-tmp","-hidir","/Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/t/cobot-io-test/build/cobot-io-test/cobot-io-test-tmp","-stubdir","/Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/t/cobot-io-test/build/cobot-io-test/cobot-io-test-tmp","-i","-i/Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/t/cobot-io-test/build/cobot-io-test/cobot-io-test-tmp","-itest","-i/Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/t/cobot-io-test/build/cobot-io-test/autogen","-i/Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/t/cobot-io-test/build/global-autogen","-I/Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/t/cobot-io-test/build/cobot-io-test/autogen","-I/Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/t/cobot-io-test/build/global-autogen","-I/Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/t/cobot-io-test/build/cobot-io-test/cobot-io-test-tmp","-optP-include","-optP/Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/t/cobot-io-test/build/cobot-io-test/autogen/cabal_macros.h","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/Users/maksbotan/.cabal/store/ghc-8.10.7/package.db","-package-db","/Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/packagedb/ghc-8.10.7","-package-db","/Users/maksbotan/.cache/hie-bios/dist-cobot-io-ddc2d1a63c5412a5f4d648ff45acce69/build/x86_64-osx/ghc-8.10.7/cobot-io-0.1.4.4/t/cobot-io-test/package.conf.inplace","-package-id","QuickCheck-2.14.2-79fK7Z8oMp1oVMHkhnSsY","-package-id","array-0.5.4.0","-package-id","attoparsec-0.13.2.5-KliAMI6nehCFfuFsYmQIi3","-package-id","base-4.14.3.0","-package-id","binary-0.8.8.0-HpmhsQDJ8BC4iODE4wIoDZ","-package-id","bytestring-0.10.12.0-BvIZHiOJL8O7XxUygqQkmw","-package-id","cobot-0.1.1.7-J7BWV7H2YYt6nEtLfBZsXI","-package-id","cobot-io-0.1.4.4-inplace","-package-id","containers-0.6.5.1-EiES0HFUZ8PBGNrpVjoYRF","-package-id","data-msgpack-0.0.13-5MCMhlwQfkRGmKTrgQxsg2","-package-id","deepseq-1.4.4.0","-package-id","directory-1.3.6.0-CbmCEFbvko1GLIMcuucehj","-package-id","hspec-2.7.10-7p5N6QxR0ylEd5MpFjsyjE","-package-id","http-conduit-2.3.8-7VKPtch8rv8UG2DCNAkED","-package-id","hyraxAbif-0.2.3.27-KEpXODL2miUCi3c7LDNQOn","-package-id","lens-4.19.2-AeXBoopYt7pJO3smpQC1t5","-package-id","linear-1.21.6-JtHSClC3cDbEmBvXQ48N03","-package-id","megaparsec-9.0.1-4kWwBUhqGyzLK7ho3iZo79","-package-id","mtl-2.2.2-Cl2NxTNak818U6bJEGW2JG","-package-id","neat-interpolation-0.5.1.2-LAL1qtR39Az1bLI4Ph4yLU","-package-id","parser-combinators-1.2.1-IbT4qyHauK0Ahn9nXuH97m","-package-id","split-0.2.3.4-IUvATEEGVazHDL4WYDj96v","-package-id","text-1.2.4.1-3ons0v27Yr7GZbokcYUGS","-package-id","vector-0.12.3.1-4FjazO9RBEZ2u7P573uIyU","-XHaskell2010","-XOverloadedStrings","-XTypeFamilies","test/Spec.hs","ABISpec","FastaParserSpec","FASTASpec","FastaWriterSpec","GBParserSpec","GBWriterSpec","MAEParserSpec","MAESpec","MMTFSpec","PDBParserSpec","PDBSpec","PDBWriterSpec","RangeSpec","SequenceSpec","StructureSpec","UniprotSpec","Paths_cobot_io","-rtsopts","-with-rtsopts=-N","-hide-all-packages","-Wall","-Werror"], componentRoot = "/Users/maksbotan/biocad/cobot-io", componentDependencies = ["cobot-io.cabal","cabal.project","cabal.project.local"]},"/nix/store/whmps8src3ca9brshhamylay2nfl82pg-ghc-shell-for-cobot-io-ghc-8.10.7-env/lib/ghc-8.10.7")
2022-06-20T13:15:01.648744Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File:     /Users/maksbotan/biocad/cobot-io/test/GBWriterSpec.hs
Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DsError
Message:  haskell-language-server: this operation requires -fexternal-interpreter
2022-06-20T13:15:01.649050Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File:     /Users/maksbotan/biocad/cobot-io/src/Bio/MMTF/MessagePack.hs
Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DsError
Message:  haskell-language-server: this operation requires -fexternal-interpreter
2022-06-20T13:15:01.649142Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File:     /Users/maksbotan/biocad/cobot-io/src/Bio/Uniprot.hs
Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DsError
Message:  haskell-language-server: this operation requires -fexternal-interpreter
2022-06-20T13:15:01.649251Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File:     /Users/maksbotan/biocad/cobot-io/test/StructureSpec.hs
Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DsError
Message:  haskell-language-server: this operation requires -fexternal-interpreter
2022-06-20T13:15:01.649527Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File:     /Users/maksbotan/biocad/cobot-io/test/MMTFSpec.hs
Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DsError
Message:  haskell-language-server: this operation requires -fexternal-interpreter
2022-06-20T13:15:01.649740Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File:     /Users/maksbotan/biocad/cobot-io/src/Bio/FASTA/Writer.hs
Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DsError
Message:  haskell-language-server: this operation requires -fexternal-interpreter
2022-06-20T13:15:01.650033Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File:     /Users/maksbotan/biocad/cobot-io/src/Bio/GB.hs
Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DsError
Message:  haskell-language-server: this operation requires -fexternal-interpreter
2022-06-20T13:15:01.650214Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File:     /Users/maksbotan/biocad/cobot-io/src/Bio/MMTF/Decode/MessagePack.hs
Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DsError
Message:  haskell-language-server: this operation requires -fexternal-interpreter
2022-06-20T13:15:01.650485Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File:     /Users/maksbotan/biocad/cobot-io/test/ABISpec.hs
Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DsError
Message:  haskell-language-server: this operation requires -fexternal-interpreter
@maksbotan maksbotan added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Jun 20, 2022
@maksbotan
Copy link
Contributor Author

Curiously enough, autocompletion works, but hover, go-to-definition, etc do not.

Happens with and without hie.yaml. For the record, it is like this:

cradle:
  cabal:
    - path: "."
      component: "lib:cobot-io"
    - path: "test"
      component: "test:cobot-io-test"

@wz1000
Copy link
Collaborator

wz1000 commented Jun 20, 2022

It seems like your GHC installation is missing an internal interpreter.
What is the output of ghc --info?

$ ghc --info
[...
,("Have interpreter","YES")
...
]

@maksbotan
Copy link
Contributor Author

$ ghc --info
 [("Project name","The Glorious Glasgow Haskell Compilation System")
 ,("GCC extra via C opts","")
 ,("C compiler command","clang")
 ,("C compiler flags","")
 ,("C++ compiler flags","")
 ,("C compiler link flags","")
 ,("C compiler supports -no-pie","NO")
 ,("Haskell CPP command","clang")
 ,("Haskell CPP flags","-E -undef -traditional -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs")
 ,("ld command","ld")
 ,("ld flags","")
 ,("ld supports compact unwind","YES")
 ,("ld supports build-id","NO")
 ,("ld supports filelist","YES")
 ,("ld is GNU ld","NO")
 ,("Merge objects command","ld")
 ,("Merge objects flags","-r")
 ,("ar command","ar")
 ,("ar flags","qcls")
 ,("ar supports at file","NO")
 ,("ranlib command","ranlib")
 ,("otool command","otool")
 ,("install_name_tool command","install_name_tool")
 ,("touch command","touch")
 ,("dllwrap command","/bin/false")
 ,("windres command","/bin/false")
 ,("libtool command","libtool")
 ,("unlit command","/nix/store/whmps8src3ca9brshhamylay2nfl82pg-ghc-shell-for-cobot-io-ghc-8.10.7-env/lib/ghc-8.10.7/bin/unlit")
 ,("cross compiling","NO")
 ,("target platform string","x86_64-apple-darwin")
 ,("target os","OSDarwin")
 ,("target arch","ArchX86_64")
 ,("target word size","8")
 ,("target has GNU nonexec stack","NO")
 ,("target has .ident directive","YES")
 ,("target has subsections via symbols","YES")
 ,("target has RTS linker","YES")
 ,("Unregisterised","NO")
 ,("LLVM target","x86_64-apple-darwin")
 ,("LLVM llc command","llc")
 ,("LLVM opt command","opt")
 ,("LLVM clang command","clang")
 ,("integer library","integer-gmp")
 ,("Use interpreter","YES")
 ,("Use native code generator","YES")
 ,("Support SMP","YES")
 ,("RTS ways","l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn thr_debug_p debug_p")
 ,("Tables next to code","YES")
 ,("Leading underscore","YES")
 ,("Use LibFFI","NO")
 ,("Use Threads","YES")
 ,("Use Debugging","NO")
 ,("RTS expects libdw","NO")
 ,("Project version","8.10.7")
 ,("Project Git commit id","1f02b7430b2fbab403d7ffdde9cfd006e884678e")
 ,("Booter version","8.6.5")
 ,("Stage","2")
 ,("Build platform","x86_64-apple-darwin")
 ,("Host platform","x86_64-apple-darwin")
 ,("Target platform","x86_64-apple-darwin")
 ,("Have interpreter","YES")
 ,("Object splitting supported","NO")
 ,("Have native code generator","YES")
 ,("Support dynamic-too","YES")
 ,("Support parallel --make","YES")
 ,("Support reexported-modules","YES")
 ,("Support thinning and renaming package flags","YES")
 ,("Support Backpack","YES")
 ,("Requires unified installed package IDs","YES")
 ,("Uses package keys","YES")
 ,("Uses unit IDs","YES")
 ,("Dynamic by default","NO")
 ,("GHC Dynamic","YES")
 ,("GHC Profiled","NO")
 ,("Debug on","NO")
 ,("LibDir","/nix/store/whmps8src3ca9brshhamylay2nfl82pg-ghc-shell-for-cobot-io-ghc-8.10.7-env/lib/ghc-8.10.7")
 ,("Global Package DB","/nix/store/whmps8src3ca9brshhamylay2nfl82pg-ghc-shell-for-cobot-io-ghc-8.10.7-env/lib/ghc-8.10.7/package.conf.d")
 ]
$ ghc --info | grep -i interp
 ,("Use interpreter","YES")
 ,("Have interpreter","YES")

@maksbotan
Copy link
Contributor Author

@wz1000 hi, do you have some ideas? I don't even know what additional info should I provide

@wz1000
Copy link
Collaborator

wz1000 commented Jun 21, 2022

I'm not sure, this might be caused by the haskell.nix patches to GHC. I would report this upstream to haskell.nix.

In the GHC 8.10.7 source code, this error is only reachable if the HAVE_INTERNAL_INTERPRETER flag is unset when GHC was built: https://gitlab.haskell.org/ghc/ghc/-/blob/ghc-8.10.7-release/compiler/ghci/GHCi.hs#L163

@maksbotan
Copy link
Contributor Author

Thanks! I will raise that issue there.

@kokobd kokobd closed this as completed Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

3 participants