-
Notifications
You must be signed in to change notification settings - Fork 64
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
cabal wrapper uses always global ghc in PATH #194
Comments
Another test, using directly the wrapper:
|
I can confirm the behaviour on linux, too. Possible fixes:
Unless a lot of users complain about this issue, I am in favour of the latter, as it will be just a few months and solve the issue for good. |
Fair enough, moreover, cabal action uses global ghc in two points:
|
I think this issue is related: #148 |
A nice workaround if you use ghcup was mentioned by @hasufell in irc: open a terminal in the project dir root and do |
That was one year ago... |
Back then it seemed like a reasonable expectation that it was going to be merged soon |
if you don't have ghcup you can do simply |
third time is the right time |
Here's a bash function for your .bashrc: with_ghc() {
local np=$(ghcup --offline whereis -d ghc $1 || { ghcup --cache install ghc $1 && ghcup whereis -d ghc $1 ;})
if [ -e "${np}" ] ; then
shift
PATH="$np:$PATH" "$@"
else
>&2 echo "Cannot find or install GHC version $1"
return 1
fi
} And for your fish config: function with_ghc
set --local np (ghcup --offline whereis -d ghc $argv[1] ; or begin ghcup --cache install ghc $argv[1] ; and ghcup whereis -d ghc $argv[1] ; end)
if test -e "$np"
PATH="$np:$PATH" $argv[2..-1]
else
echo "Cannot find or install GHC version $argv[1]" 1>&2
return 1
end
end use: with_ghc 8.10.5 sh -c 'echo $PATH'
with_ghc 8.10.5 cabal build
with_ghc 8.10.5 code . Edit: I feel I just reimplemented stack. |
Since the cabal patch is merged, I guess this can move forward |
Yep, but not quite ideal yet, as we still have no quick way of querying for the project ghc. Currently, it requires to build at least one cabal component. |
Well, that means if I run |
if you launch the correct language server (e.g. 8.6.5 for projects that use 8.6.5) then it will work (assuming MR #301) even without running |
BTW, MR #301 is not correct currently, as it does not use the latest json lib decoder/encoder for build-info. |
The last promising hack to get the path to ghc could be:
ugly but seems to work for now.
The error without that option and without the costly full build is:
Talking with @fendor it seems i can be used in a more direct way than #282 so maybe it could be used in another smaller pr if i understood it correctly |
with-compiler: ghc-8.6.5
in thecabal.project
hie-bios was using my default ghc in path (ghc-8.8.3)--interactive
https://github.com/mpickering/hie-bios/blob/293baaf793f82f639affe734ebe785ccdcafd40b/wrappers/cabal.hs#L19
ghc --numeric-version
, being "ghc" the programs passed in-w
as first option, to know the actual ghc version in useghcPath
here )Possible solutions:
HIE_BIOS_WRAPPER_GHC
?) to inform the wrapper about the real ghc--hie-bios-ghc
and use it, removing it before calling the real ghcThe text was updated successfully, but these errors were encountered: