haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 210 forks source link

HIE fails when run from within VSCode #483

Closed marmistrz closed 5 years ago

marmistrz commented 6 years ago

cross-reporting https://github.com/alanz/vscode-hie-server/issues/54

2018-02-28 11:25:30.079606543 [ThreadId 4] - Setting home directory:/home/marcin
2018-02-28 11:25:30.08072305 [ThreadId 4] - run entered for HIE Version 0.1.0.0, Git revision dd262b8283b3584d9d106bc842eae894826495ca (1205 commits) x86_64 ghc-8.2.2
2018-02-28 11:25:30.081598744 [ThreadId 4] - Current directory:/home/marcin
hie: Could not find $libexecdir/cabal-helper-wrapper

If you are a cabal-helper developer you can set the environment variable
`cabal_helper_libexecdir' to override $libexecdir[1]. The following will
work in the cabal-helper source tree:

    $ export cabal_helper_libexecdir=$PWD/dist/build/cabal-helper-wrapper

[1]: /home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/libexec/x86_64-linux-ghc-8.2.2/cabal-helper-0.8.0.2

If you don't know what I'm talking about something went wrong with your
installation. Please report this problem here:

    https://github.com/DanielG/cabal-helper/issues

I installed haskell-ide-engine-git from AUR (Arch Linux). I can't find cabal-helper-wrapper anywhere in my FS.

alanz commented 6 years ago

Make sure you have cabal-helper installed, and perhaps cabal-install.

marmistrz commented 6 years ago

It looks like the AUR package didn't pull cabal-helper as a dependency. I took it from the repos. The wrapper is now in

/usr/lib/x86_64-linux-ghc-8.2.2/cabal-helper-0.8.0.2/cabal-helper-wrapper

Still, after installing, hie seems to insist on using the build root location instead:

2018-02-28 16:44:26.355238933 [ThreadId 4] - Setting home directory:/home/marcin
2018-02-28 16:44:26.35687703 [ThreadId 4] - run entered for HIE Version 0.1.0.0, Git revision dd262b8283b3584d9d106bc842eae894826495ca (1205 commits) x86_64 ghc-8.2.2
2018-02-28 16:44:26.35786075 [ThreadId 4] - Current directory:/home/marcin
hie: Could not find $libexecdir/cabal-helper-wrapper

If you are a cabal-helper developer you can set the environment variable
`cabal_helper_libexecdir' to override $libexecdir[1]. The following will
work in the cabal-helper source tree:

    $ export cabal_helper_libexecdir=$PWD/dist/build/cabal-helper-wrapper

[1]: /home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/libexec/x86_64-linux-ghc-8.2.2/cabal-helper-0.8.0.2
alanz commented 6 years ago

Then it is related to how AUR does things. Perhaps @DanielG can help, on https://github.com/DanielG/cabal-helper

marmistrz commented 6 years ago

Well, AUR does nothing obviously weird: the package is just built and installed.

https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=haskell-ide-engine-git

alanz commented 6 years ago

Its not an install problem, its a runtime problem. ghc-mod uses cabal-helper, and between them there are some expectations about what can be found where, to get configured.

marmistrz commented 6 years ago

It looks like setting the environment variable mentioned in the error message seems to work around the problem:

cabal_helper_libexecdir=/usr/lib/x86_64-linux-ghc-8.2.2/cabal-helper-0.8.0.2/
marmistrz commented 6 years ago

It looks like the resulting binary some paths hardcoded during configure/make, and it's done absolutely wrong

$ strings /usr/bin/hie | grep pacaur
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/bin
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/lib/x86_64-linux-ghc-8.2.2/haskell-ide-engine-0.1.0.0-1jxxdsETSU8AvhrJkZ6UGU-hie
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/lib/x86_64-linux-ghc-8.2.2
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/haskell-ide-engine-0.1.0.0
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/libexec/x86_64-linux-ghc-8.2.2/haskell-ide-engine-0.1.0.0
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/etc
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/lib/x86_64-linux-ghc-8.2.2/ghc-mod-core-5.9.0.0-GodznVjeigkJvVybP5ajf0
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/ghc-mod-core-5.9.0.0
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/libexec/x86_64-linux-ghc-8.2.2/ghc-mod-core-5.9.0.0
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/lib/x86_64-linux-ghc-8.2.2/cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/cabal-helper-0.8.0.2
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/libexec/x86_64-linux-ghc-8.2.2/cabal-helper-0.8.0.2

the system-wide paths are not in the executable anywhere:

$ strings /usr/bin/hie | grep share/
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/haskell-ide-engine-0.1.0.0
/home/marcin/.stack/snapshots/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/hoogle-5.0.16
/home/marcin/.stack/snapshots/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/warp-3.2.17
/home/marcin/.stack/snapshots/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/js-jquery-3.2.1
/home/marcin/.stack/snapshots/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/js-flot-0.8.3
/usr/local/share/certs/
/home/marcin/.stack/snapshots/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/hlint-2.1
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/ghc-mod-core-5.9.0.0
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/cabal-helper-0.8.0.2
/home/marcin/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.2.2/share/doc/ghc-8.2.2/html/libraries/base-4.10.1.0
/home/marcin/.stack/snapshots/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/ekg-0.4.0.14
/home/marcin/.stack/snapshots/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/snap-server-1.0.3.3
/home/marcin/.stack/snapshots/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/Cabal-2.0.1.1

or

$ strings /usr/bin/hie | grep cabal-helper
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs
cabal-helper-wrapper
https://github.com/DanielG/cabal-helper/issues
If you are a cabal-helper developer you can set the environment variable
work in the cabal-helper source tree:
cabal-helper.cabal
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:Distribution.Helper.LibexecNotFoundError
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:Distribution.Helper.SomeLocalBuildInfo
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:Distribution.Helper.QueryEnv
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:Distribution.Helper.Programs
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ProduceBuildOutput
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.NoBuildOutput
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChPkgGlobal
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChPkgUser
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChPkgSpecific
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChSetupEntrypoint
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChLibEntrypoint
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChExeEntrypoint
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChSetupHsName
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChLibName
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChSubLibName
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChFLibName
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChExeName
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChTestName
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChBenchName
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChResponseCompList
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChResponseEntrypoints
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChResponseNeedsBuild
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChResponseList
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChResponsePkgDbs
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChResponseLbi
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChResponseVersion
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChResponseLicenses
cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs:CabalHelper.Shared.InterfaceTypes.ChResponseFlags
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/lib/x86_64-linux-ghc-8.2.2/cabal-helper-0.8.0.2-ITEOSbhm2le15tRSF89fFs
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/share/x86_64-linux-ghc-8.2.2/cabal-helper-0.8.0.2
/home/marcin/.cache/pacaur/haskell-ide-engine-git/src/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6-nopie/nightly-2018-02-26/8.2.2/libexec/x86_64-linux-ghc-8.2.2/cabal-helper-0.8.0.2
marmistrz commented 6 years ago

This seems closely related to #400

samuelpilz commented 6 years ago

This is still an issue. I experience it with the atom plugin. My issue is that I do not have cabal-helper-wrapper installed. The Readme does not mention that this is required.

Is it required to separatly install cabal-helper? Why is it not contained within the hie build?

DanielG commented 6 years ago

Looks to me like this is in fact an AUR problem. They use stack build/stack install which is just not going to work because it does exactly this sort of path hardcoding without a way to override it. I assume everything worked for the PKGBUILD author because they still had the .stack-work stuff lying around when testing it.

samuelpilz commented 6 years ago

@DanielG I installed hie directly via git.

git clone --recursive ...
make build-all

I assume it worked because the cabal-helper-wrapper is found somewhere

samuelpilz commented 6 years ago

It works for me now: I copied the cabal-helper-wrapper executable that is build as well when doing make build-all into my local bin folder and pointed cabal_helper_libexecdir to that dir.

Not sure if all that was necessary, but it works now :tada:

thomashoneyman commented 5 years ago

I've run into the same issue, but on MacOS also using git clone --recursive ... make build-all.