-
Notifications
You must be signed in to change notification settings - Fork 207
Conversation
Also updates the target `cabal-build` to only build hie for versions that are installed
Merge remote-tracking branch 'upstream/master' into shake-cabal
install.hs
install.hs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting an error when building with ghc-8.4.4 via ./install.sh cabal-build-all
on macOS:
Error when running Shake build system:
* cabal-build-all
* cabal-build
* cabal-hie-8.4.4
user error (Development.Shake.command_, system command failed
Command: cabal new-build --write-ghc-environment-files=never
Exit code: 1
Stderr:
<command line>: can't load .so/.DLL for: /Users/luke/.cabal/store/ghc-8.4.4/lib/libHShddck-p-2.20.0-12cd95e5-ghc8.4.4.dylib (dlopen(/Users/luke/.cabal/store/ghc-8.4.4/lib/libHShddck-p-2.20.0-12cd95e5-ghc8.4.4.dylib, 5): Symbol not found: _timezm1zi8zi0zi2_DataziTimeziClockziInternalziCTimespec_zdwclockGetTime_closure
Referenced from: /usr/local/opt/ghc/lib/ghc-8.4.4/ghc-8.4.4/libHSghc-8.4.4-ghc8.4.4.dylib
Expected in: /Users/luke/.stack/programs/x86_64-osx/ghc-8.4.4/lib/ghc-8.4.4/bin/../time-1.8.0.2/libHStime-1.8.0.2-ghc8.4.4.dylib
in /usr/local/opt/ghc/lib/ghc-8.4.4/ghc-8.4.4/libHSghc-8.4.4-ghc8.4.4.dylib)
cabal: Failed to build haskell-ide-engine-0.6.0.0 (which is required by
exe:hie-wrapper from haskell-ide-engine-0.6.0.0, lib:hie-test-utils from
haskell-ide-engine-0.6.0.0 and others).
Not sure why both stack and my system ghc are shown in the paths above
Here are my GHCs installed:
Found the following GHC paths:
ghc-8.6.3: /usr/local/bin/ghc-8.6.3
ghc-8.6.2: /usr/local/bin/ghc-8.6.2
ghc-8.4.4: /Users/luke/.stack/programs/x86_64-osx/ghc-8.4.4/bin/ghc-8.4.4
Hmpf, I think Maybe there is a difference between GHCs installed by stack and those installed from source/package manager? At least for MacOS, since it worked for NixOs, Windows and Fedora with GHCs installed by stack. |
Cleaning up my dist and dist-newstyle seemed to help, I presume something funny went wrong in the configure step, probably not the fault of the install script. |
Mainly because then we know where the locations of the executables are located. It then also has the same behaviour as |
I believe |
Yes, but I am not sure where it is on windows and also it might break if someone has a custom cabal configuration. |
@fendor do i understand correctly that this PR adds\alters cabal targets, while stack targets are unaffected? Also, if those cabal targets aren't properly working on Windows - will user get a clear message about it if he tries to run it on Windows machine? |
@Anrock That is right, it adds targets to build HIE via |
@fendor borderline acceptable, imo. Could you either hide broken cabal targets or fail them instantly with error message specifically for Windows? If no/too much effort, then LGTM. |
@Anrock You are right, I will add a check whether the script is executed on |
@fendor shouldn't it be |
I am out of my depth on this one, but if you guys are happy with it, it can merge. |
On my windows, I tested it with |
Should show now a nice error message when trying to use one of the cabal targets. |
A fitting readme is missing. |
I am worried about the first-time user experience with this. Running the bare command gives a wall of text, with so many options it is not clear what is going on.
|
I agree with that, however, in the readme there are simple instructions |
This sounds like a good idea. |
This way we no longer have to rely on the nightly resolver located in stack.yaml and only one resolver is downloaded if HIE is to be installed via cabal-new-build
Introduced short help message that only shows the commands absolutely necessary, example output: > stack install.hs # equal to `stack install.hs short-help` and `stack install.hs all`
Usage:
stack install.hs <target>
Targets:
help Show help message including all targets
build Builds hie for all supported GHC versions (8.2.1, 8.2.2, 8.4.2, 8.4.3, 8.4.4, 8.6.1, 8.6.2 and 8.6.3)
build-all Builds hie and hoogle databases for all supported GHC versions
hie-8.6.3 Builds hie for GHC version 8.6.3 only with stack
build-doc-8.6.3 Builds the Hoogle database for GHC version 8.6.3 only with stack
hie-8.4.4 Builds hie for GHC version 8.4.4 only with stack
build-doc-8.4.4 Builds the Hoogle database for GHC version 8.4.4 only with stack
cabal-ghcs Show all GHC versions that can be installed via `cabal-build` and `cabal-build-all`.
cabal-build Builds hie with cabal with all installed GHCs.
cabal-build-all Builds hie and hoogle databases for all installed GHC versions with cabal
cabal-hie-8.6.3 Builds hie for GHC version 8.6.3 only with cabal new-build
cabal-build-doc-8.6.3 Builds the Hoogle database for GHC version 8.6.3 only with cabal
cabal-hie-8.4.4 Builds hie for GHC version 8.4.4 only with cabal new-build
cabal-build-doc-8.4.4 Builds the Hoogle database for GHC version 8.4.4 only with cabal
Build completed in 0.00s |
In my opinion, ready to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I picked up one tiny typo in the README, once that is fixed I am happy for this to land.
LGTM, will land it once CI completes |
Do I understand it correctly that this PR show to make it possible to install HIE without stack? Because I tried to do that on my system (x86_64 linux, w/o stack, with ghc 8.6.3) and it failed. Specifically, I compiled
which indicates that it needs stack to continue. |
No, it means you can build hie with cabal, we still require stack to ensure that cabal is installed and to know the |
Closes #1047
Discovers GHC installations that can be found via
System.Directory.findExecutable
. Found GHC installations are shown withcabal-ghcs
target.Adapts the target
cabal-build
andcabal-docs
to only install HIE for GHCs that have already been found.HIE executables are installed to
$HOME/.local/bin
. The main executablehie
will be symlinked to that location, as well ashie-wrapper
, while the other executables will be copied. We could also symlink them, but this may cause Problems for Windows. On the other hand, we could also replace the symlinkedhie
andhie-wrapper
with real copies, or wait until the respective flag lands incabal
.Adds more helpful error messages such as, "GHC not found!".
Blockers
Tested on the systems:
Windows, does currently not work sincecabal new-install
does not work for windows, see Task: Implementv2-install --bindir-method={copy,symlink}
cabal#5837The documentation needs some changes. If someone uses
cabal new-build
without our smart wrapper, a.ghc.environment
file is generated. Almost any tool seems to read that and consequentially, the scriptinstall.hs
can not be run because its dependencies are not added to the local.ghc.environment
file. We can not include a fix for this, like deleting the file if present, in the install.hs since it can not be run at all. Thus, I propose we add this to the FAQ.Discussion:
cabal
target needed for installation via cabal new-build?I removed it for now.We require thatWe no longer require$HOME/.cabal/bin
is in the path instead of$HOME/.local/bin
in the current implementation.$HOME/.cabal/bin
to be on the $PATH.