Couldn't execute stack setup --silent
mkoloberdin opened this issue · 9 comments
I am experiencing a problem with stack
projects both while manually running hie-bios
as well as via HLS.
Here is an excerpt from VSCodium's log (HLS version 1.4.0, OS: Arch Linux):
setInitialDynFlags cradle: Cradle {cradleRootDir = "/path-to-my-project", cradleOptsProg = CradleAction: Stack}
Couldn't load cradle for libdir: (CradleError {cradleErrorDependencies = [], cradleErrorExitCode = ExitSuccess, cradleErrorStderr = ["Couldn't execute stack setup --silent"]},"/path-to-my-project",Nothing,Cradle {cradleRootDir = "/path-to-my-project", cradleOptsProg = CradleAction: Stack})
Note the cradleErrorExitCode = ExitSuccess
yet cradleErrorStderr = ["Couldn't execute stack setup --silent"]
.
Originally posted by @mkoloberdin in haskell/haskell-language-server#236 (comment)
If I modify the stackCradle
function in Cradle.hs
to run stack
via env -S ...
this issue goes away but hie-bios
then dies with this error message:
hie-bios: stack: streamingProcess: exec: invalid argument (Bad file descriptor)
What happens if you execute stack setup
in the root of your project? What is the error message?
It works fine. No error message but this goes to stderr
:
stack will use a sandboxed GHC it installed
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec
If I do a rm -rf ~/.stack
first, then this gets spit out to stderr
:
Preparing to install GHC (tinfo6) to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-tinfo6-8.10.7.
Installed GHC.
stack will use a sandboxed GHC it installed
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec
And stack setup --silent
does not fail with an error-code?
Nope:
$ stack setup --silent && echo "Success"
Success
but hie-bios
fails, claiming it can't execute stack setup --silent
? Can you change that to stack setup
instead (in hie-bios), so you see stdout and stderr in the error message.
I've hit this issue as well (running on an M1 mac). Changing to stack setup
in hie-bios gave the following besides Couldn't execute stack setup --silent
:
Failed to get project GHC version:CradleError {cradleErrorDependencies = [], cradleErrorExitCode = ExitFailure 1, cradleErrorStderr = ["Error when calling stack setup","","The GHC located at /Users/dani/.stack/programs/aarch64-osx/ghc-8.10.7/bin/ghc-8.10.7 failed to compile a sanity check. Please see:\n\n http://docs.haskellstack.org/en/stable/install_and_upgrade/\n\nfor more information. Exception was:\nReceived ExitFailure 1 when running\nRaw command: /Users/dani/.stack/programs/aarch64-osx/ghc-8.10.7/bin/ghc-8.10.7 /private/var/folders/bb/ylwx59tn6136lc7m0vth80_c0000gp/T/stack-sanity-check-9692de1554b0c717/Main.hs -no-user-package-db\nRun from: /private/var/folders/bb/ylwx59tn6136lc7m0vth80_c0000gp/T/stack-sanity-check-9692de1554b0c717/\nStandard output:\n\n[1 of 1] Compiling Main ( /private/var/folders/bb/ylwx59tn6136lc7m0vth80_c0000gp/T/stack-sanity-check-9692de1554b0c717/Main.hs, /private/var/folders/bb/ylwx59tn6136lc7m0vth80_c0000gp/T/stack-sanity-check-9692de1554b0c717/Main.o )\nStandard error:\n\n\n<no location info>: error:\n Warning: Couldn't figure out LLVM version!\n Make sure you have installed LLVM between [9 and 13)\nghc: could not execute: opt\n\n"]}
Formatted cradleErrorStderr
:
The GHC located at /Users/dani/.stack/programs/aarch64-osx/ghc-8.10.7/bin/ghc-8.10.7 failed to compile a sanity check. Please see:
http://docs.haskellstack.org/en/stable/install_and_upgrade/
for more information. Exception was:
Received ExitFailure 1 when running
Raw command: /Users/dani/.stack/programs/aarch64-osx/ghc-8.10.7/bin/ghc-8.10.7 /private/var/folders/bb/ylwx59tn6136lc7m0vth80_c0000gp/T/stack-sanity-check-9692de1554b0c717/Main.hs -no-user-package-db
Run from: /private/var/folders/bb/ylwx59tn6136lc7m0vth80_c0000gp/T/stack-sanity-check-9692de1554b0c717/
Standard output:
[1 of 1] Compiling Main ( /private/var/folders/bb/ylwx59tn6136lc7m0vth80_c0000gp/T/stack-sanity-check-9692de1554b0c717/Main.hs, /private/var/folders/bb/ylwx59tn6136lc7m0vth80_c0000gp/T/stack-sanity-check-9692de1554b0c717/Main.o )
Standard error:
<no location info>: error:
Warning: Couldn't figure out LLVM version!
Make sure you have installed LLVM between [9 and 13)
ghc: could not execute: opt
brew link llvm@12
fixed the issue for me!
but
hie-bios
fails, claiming it can't executestack setup --silent
? Can you change that tostack setup
instead (in hie-bios), so you see stdout and stderr in the error message.
Just tried this with no other modifications and lts-18.7:
$ hie-bios check .
hie-bios: CradleError {cradleErrorDependencies = [], cradleErrorExitCode = ExitSuccess, cradleErrorStderr = ["Couldn't execute stack setup"]}
Closed, this seems to be not happening anymore?
Feel free to reopen if you still suffer from this.