Closed kozross closed 4 years ago
The install.hs script looks for ghc executables in $PATH
following the convention ghc-${version}
, and the default ghc installation has a executable with that name schema. The other requirement is that a stack-${ghcVersion}.yaml
should be in hie main dir. Otoh versions ghc-8.8.1
and ghc-8.8.2
are not usable in windows (but it seems you are on linux).
If both requirements are fullfilled it must list hie-8.8.1
, the ghc you are using, so it is a little bit weird.
That is the output in my win system:
D:\ws\haskell\haskell-ide-engine>cabal-hie-install ghcs
Building the script
********************************************************************************
Found the following GHC paths:
ghc-8.4.4: D:\bin\Programs\stack\x86_64-windows\ghc-8.4.4\bin\ghc-8.4.4.exe
ghc-8.6.4: D:\bin\Programs\stack\x86_64-windows\ghc-8.6.4\bin\ghc-8.6.4.exe
ghc-8.6.5: D:\bin\Programs\stack\x86_64-windows\ghc-8.6.5\bin\ghc-8.6.5.exe
********************************************************************************
Build completed in 0.02s
D:\ws\haskell\haskell-ide-engine>cabal-hie-install help
...............
Usage:
stack install.hs <target>
or
cabal v2-run install.hs --project-file install/shake.project <target>
Targets:
help Show help message including all targets
hie Install hie with the latest available GHC and the data files
latest Install hie with the latest available GHC
data Get the required data-files for `hie` (Hoogle DB)
hie-8.4.4 Install hie for GHC version 8.4.4
hie-8.6.4 Install hie for GHC version 8.6.4
hie-8.6.5 Install hie for GHC version 8.6.5
ghcs Show all GHC versions that can be installed via `cabal-build`.
icu-macos-fix Fixes icu related problems in MacOS
Build completed in 0.04s
EDIT: i've just spotted the -w /home/koz/ghc-88/bin/ghc
of your command. I am afraid that the install script are assuming the ghc(s) are in path, following the convention (used by ghcup f.e.) that you add all availables ghcs in path, prepending your preferred one to use it simply with ghc
.
Then cabal commands for alternative ghcs usually are: cabal command -w ghc-${version}
So the ghc used to run the script and the ghc used to install hie can be different.
So how should I then use the install script in my case? Just pick latest
? Does this mean that the resulting HIE would work against the GHC I passed with -w
?
Also, when I tried the hie
target, I got this:
[koz@Emi haskell-ide-engine]$ cabal new-run -w /home/koz/ghc-88/bin/ghc ./install.hs --project-file install/shake.project hie
Resolving dependencies...
Build profile: -w ghc-8.8.2 -O1
In order, the following will be built (use -v for more details):
- fake-package-0 (exe:script) (configuration changed)
Configuring executable 'script' for fake-package-0..
Preprocessing executable 'script' for fake-package-0..
Building executable 'script' for fake-package-0..
[1 of 1] Compiling Main ( Main.hs, /home/koz/haskell-ide-engine/dist-newstyle/build/x86_64-linux/ghc-8.8.2/fake-package-0/x/script/build/script/script-tmp/Main.o )
Linking /home/koz/haskell-ide-engine/dist-newstyle/build/x86_64-linux/ghc-8.8.2/fake-package-0/x/script/build/script/script ...
Error when running Shake build system:
at want, called at src/Development/Shake/Internal/Args.hs:83:69 in shake-0.18.4-7f9bbcf2493dbc2db46e30ab4e42e1ac58ec0e14c5725b2c6dcbf00ea205c199:Development.Shake.Internal.Args
* Depends on: hie
at apply1, called at src/Development/Shake/Internal/Rules/Rerun.hs:41:5 in shake-0.18.4-7f9bbcf2493dbc2db46e30ab4e42e1ac58ec0e14c5725b2c6dcbf00ea205c199:Development.Shake.Internal.Rules.Rerun
* Depends on: latest
* Raised the exception:
Prelude.last: empty list
I'm assuming this is because I have my GHCs not where ghcup
would put them? Given that as far as I know, ghcup
is unable to provide LLVM versions to go with its compilers (the reason I've done it manually like I have is not least of all that), which makes me basically unable to use HIE, or even install it.
I'm assuming this is because I have my GHCs not where ghcup would put them?
Not exactly, the script assumes that ghc is in $PATH, it should work simply adding to it. I only mentioned ghcup cause it follows the convention of adding ghcs to $PATH.
> export PATH=/path/to/ghc/bin:$PATH
> ./cabal-hie-install latest
should work
That said, the Prelude.last: empty list
is not user friendly, it should show a message warning telling that ghc should be in path
Prelude.last: empty list is not user friendly, it should show a message
I wonder if Safe.lastNote would be sufficient
And for local environment changes the following also works, but it doesn't pollute current shell:
PATH=/path/to/ghc/bin:$PATH ./cabal-hie-install latest
I can confirm that the suggested PATH
-based approaches work correctly. Thank you!
I was trying to install HIE today. The log shows best what happened.
I can't see any targets except
latest
. Is this a bug, or am I missing something?