Skip to content
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

Couldn't execute stack setup --silent #311

Closed
mkoloberdin opened this issue Sep 17, 2021 · 9 comments
Closed

Couldn't execute stack setup --silent #311

mkoloberdin opened this issue Sep 17, 2021 · 9 comments
Labels
build tool: stack type: bug Something isn't working

Comments

@mkoloberdin
Copy link

mkoloberdin commented Sep 17, 2021

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)

@mkoloberdin
Copy link
Author

mkoloberdin commented Sep 18, 2021

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)

@jneira jneira added the type: bug Something isn't working label Sep 19, 2021
@fendor
Copy link
Collaborator

fendor commented Sep 20, 2021

What happens if you execute stack setup in the root of your project? What is the error message?

@mkoloberdin
Copy link
Author

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

@fendor
Copy link
Collaborator

fendor commented Sep 20, 2021

And stack setup --silent does not fail with an error-code?

@mkoloberdin
Copy link
Author

Nope:

$ stack setup --silent && echo "Success"
Success

@fendor
Copy link
Collaborator

fendor commented Sep 20, 2021

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.

@EpicOrange
Copy link

EpicOrange commented Oct 17, 2021

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!

@mkoloberdin
Copy link
Author

mkoloberdin commented Nov 18, 2021

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.

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"]}

@fendor
Copy link
Collaborator

fendor commented Jun 16, 2023

Closed, this seems to be not happening anymore?

Feel free to reopen if you still suffer from this.

@fendor fendor closed this as completed Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build tool: stack type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants