haskell-vim-now icon indicating copy to clipboard operation
haskell-vim-now copied to clipboard

Stack setup failed with error 1

Open milesfrain opened this issue 5 years ago • 27 comments

$ bash /tmp/haskell-vim-now.sh
...
HvnArgs {hvnArgsNoHoogleDb = False, hvnArgsNoHelperBinaries = False}
Setting up GHC if needed...
Stack setup failed with error 1
*** setup_haskell.hs failed with error 1.
*** Aborting...

Adding set -x to the top of the shell script shows that this is the failing command:

stack /home/miles/.config/haskell-vim-now/scripts/setup_haskell.hs

I believe I have all the dependencies:

$ ghcide --version
ghcide version: 0.2.0 (GHC: 8.6.5) (PATH: /home/miles/.local/bin/ghcide) (GIT hash: 0ddc62fb96ada49d660382fbd91835f964c241ef)
$ hlint --version 
HLint v2.1.26, (C) Neil Mitchell 2006-2019
$ hoogle --version
Hoogle 5.0.17.11, https://hoogle.haskell.org/
$ stack ghc -- --version   
The Glorious Glasgow Haskell Compilation System, version 8.8.3

Not sure if it's an issue that ghc can only be launched via stack.

milesfrain avatar Jun 17 '20 04:06 milesfrain

Maybe the problem is that setup_haskell.hs calls stack internally with a shabang: https://github.com/begriffs/haskell-vim-now/blob/master/scripts/setup_haskell.hs#L1

So invoking stack /foo/bar/setup_haskell.hs may be redundant? Perhaps the script should be run directly on its own...

I believe @p-alik is familiar with that section of code and may be able to investigate.

begriffs avatar Jun 20 '20 17:06 begriffs

Installation succeeded on ubuntu 18.04. ghc v8.6.5 is only difference in my environment because installation of 8.8.3 failed despite allow-newer setting with

stack --version
Version 2.3.1, Git revision de2a7b694f07de7e6cf17f8c92338c16286b2878 (8103 commits) x86_64 hpack-0.33

I believe I have all the dependencies

setup_haskell.hs doesn't look for installed helpers. It overrides them heedlessly.

p-alik avatar Jun 20 '20 20:06 p-alik

I also see this error on a more or less clean install of Ubuntu 20.04. Am too much of a noob to diagnose but happy to provide additional info about this system.

saniac avatar Aug 14 '20 22:08 saniac

@saniac, please provide:

  • stack --version
  • stack ghc -- --version
  • stack setup --verbosity warning, which cause the error https://github.com/begriffs/haskell-vim-now/blob/df31c3a6d64c8f2d332e8f09b42a4bc129dce639/scripts/setup_haskell.hs#L102

p-alik avatar Aug 15 '20 06:08 p-alik

Run in my home directory, I hope that's right.

stack --version Version 2.3.3, Git revision cb44d51bed48b723a5deb08c3348c0b3ccfc437e x86_64 hpack-0.33.0

stack ghc -- --version The Glorious Glasgow Haskell Compilation System, version 8.8.3

stack setup --verbosity warning

( doesn't produce any output.)

saniac avatar Aug 15 '20 06:08 saniac

Could you try to execute stack setup with --resolver please, which is used by https://github.com/begriffs/haskell-vim-now/blob/df31c3a6d64c8f2d332e8f09b42a4bc129dce639/scripts/setup_haskell.hs#L4

However on a new vagrant box ubuntu/focal64 I can't reproduce the issue:

vagrant@ubuntu-focal:~$ stack setup --resolver lts-14.12 --verbosity warning
vagrant@ubuntu-focal:~$ echo $?
0

p-alik avatar Aug 16 '20 17:08 p-alik

stack setup --resolver lts-14.12 --verbosity warning (no output)

echo $7 (no output)

My laptop has a fairly new Focal install. I've just checked my bash history to see how I got Haskell and stack set up, in case that's relevant.

I installed the haskell-platform. Then installed haskell-stack. Then executed stack upgrade.

saniac avatar Aug 16 '20 19:08 saniac

echo $7

echo $? prints last command exit status. If it prints 0 there is no issue and you could install by running ~/.config/haskell-vim-now/install.sh,. ~/.config/haskell-vim-now/ created by /tmp/haskell-vim-now.sh.

p-alik avatar Aug 17 '20 05:08 p-alik

Output:

~/.config/haskell-vim-now/install.sh --> Existing Haskell-Vim-Now installation detected at /home/stephen/.config/haskell-vim-now. --- Syncing Haskell-Vim-Now with upstream... Already up to date. Current branch master is up to date. --- Installing system packages [libcurl4-openssl-dev] using [APT]... --- Installing with apt-get... [sudo] password for stephen: Reading package lists... Done Building dependency tree
Reading state information... Done Skipping libcurl4-openssl-dev, it is already installed and upgrade is not set. The following packages were automatically installed and are no longer required: libfprint-2-tod1 python3-cliapp python3-markdown python3-packaging python3-pygments python3-pyparsing python3-ttystatus Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. --- Checking ctags' exuberance... --- Setting git to use fully-pathed vim for messages... --- Backing up current vim config using timestamp 20200817_175158... /home/stephen/.config/haskell-vim-now/backup/.vim.20200817_175158 /home/stephen/.config/haskell-vim-now/backup/.vimrc.20200817_175158 --- Creating vim config symlinks ~/.vimrc -> /home/stephen/.config/haskell-vim-now/.vimrc ~/.vim -> /home/stephen/.config/haskell-vim-now/.vim --- Installing plugins using vim-plug... HvnArgs {hvnArgsNoHoogleDb = False, hvnArgsNoHelperBinaries = False} Setting up GHC if needed... Stack setup failed with error 1 *** setup_haskell.hs failed with error 1. *** Aborting...

saniac avatar Aug 17 '20 05:08 saniac

But also:

stack setup --resolver lts-14.12 --verbosity warning

echo $0 /bin/bash

Which is not 0.

I'm just theorising here, but I have bash-it installed. I wonder if something it does is interfering with the shell scripts. I'm just going to uninstall it and see what happens.

saniac avatar Aug 17 '20 05:08 saniac

Update: removing bash-it did not make a difference.

saniac avatar Aug 17 '20 06:08 saniac

I couldn't reproduce the issue in any of on default installed shells bash, sh or dash. No issue even with bash-it. Maybe making stack more talkative can help. Please try

echo $SHELL
which stack
set -x
stack setup --resolver lts-14.12 --verbosity debug
echo $?
set +x # to disable set -x

p-alik avatar Aug 17 '20 07:08 p-alik

Output attached.

output.txt

saniac avatar Aug 17 '20 07:08 saniac

That's weird, stack setup --resolver lts-14.12 --verbosity debug exits with 0, but for stack setup --resolver lts-14.12 --verbosity warning with not 0? In this case that's an issue for stack team. Could you check exit code for --verbosity warning one more time please?

p-alik avatar Aug 17 '20 08:08 p-alik

I'm sorry to have wasted your time, I'm an idiot who has not closely read instructions. I've reviewed carefully and realise now that sometimes I was typing "echo $0" not "echo $?".

$? is 0 consistently for both "stack setup --resolver lts-14.12 --verbosity debug" and "stack setup --resolver lts-14.12 --verbosity warning".

saniac avatar Aug 17 '20 09:08 saniac

In this case ~/.config/haskell-vim-now/install.sh should fail (at least in on stack setup). Please retry.

p-alik avatar Aug 17 '20 10:08 p-alik

Yes, the last lines are:

--- Installing plugins using vim-plug... HvnArgs {hvnArgsNoHoogleDb = False, hvnArgsNoHelperBinaries = False} Setting up GHC if needed... Stack setup failed with error 1 *** setup_haskell.hs failed with error 1. *** Aborting...

saniac avatar Aug 17 '20 19:08 saniac

@saniac With @p-alik's #299 merged, hopefully the stack setup call will provide more info. Would you please try again when you get a chance?

jship avatar Aug 25 '20 14:08 jship

Tried again, output below.

...
Stack setup failed with exit code: 1
stderr: RedownloadInvalidResponse Request {
  host                 = "raw.githubusercontent.com"
  port                 = 443
  secure               = True
  requestHeaders       = []
  path                 = "/fpco/lts-haskell/master//lts-16.10.yaml"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 "/home/stephen/.stack/build-plan/lts-16.10.yaml" (Response {responseStatus = Status {statusCode = 404, statusMessage = "Not Found"}, responseVersion = HTTP/1.1, responseHeaders = [("Connection","keep-alive"),("Content-Length","14"),("Content-Type","text/plain; charset=utf-8"),("Content-Security-Policy","default-src 'none'; style-src 'unsafe-inline'; sandbox"),("Strict-Transport-Security","max-age=31536000"),("X-Content-Type-Options","nosniff"),("X-Frame-Options","deny"),("X-XSS-Protection","1; mode=block"),("Via","1.1 varnish (Varnish/6.0)"),("X-GitHub-Request-Id","72BE:0BDE:1FBA06:23672E:5F45F959"),("Accept-Ranges","bytes"),("Date","Wed, 26 Aug 2020 05:55:38 GMT"),("Via","1.1 varnish"),("X-Served-By","cache-akl10333-AKL"),("X-Cache","MISS, MISS"),("X-Cache-Hits","0, 0"),("X-Timer","S1598421338.249071,VS0,VE303"),("Vary","Authorization,Accept-Encoding"),("Access-Control-Allow-Origin","*"),("X-Fastly-Request-ID","757882ecee632259d3ac142fcdcbe5c18471ac42"),("Expires","Wed, 26 Aug 2020 06:00:38 GMT"),("Source-Age","0")], responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose})

stdout: 
*** setup_haskell.hs failed with error 1.
*** Aborting...
stephen@vivo:~$  

saniac avatar Aug 26 '20 05:08 saniac

Thank you, @saniac! We've to wait for response in https://github.com/commercialhaskell/stackage/issues/5615

p-alik avatar Aug 26 '20 07:08 p-alik

There is no mention of the stack version.

If this is a stack 1.9 report, then it is no longer supported.

juhp avatar Sep 06 '20 05:09 juhp

@juhp, stack 2.3.3 is mentioned above

p-alik avatar Sep 06 '20 10:09 p-alik

Okay, I am not sure what is going on but I think the location should be https://github.com/commercialhaskell/stackage-snapshots/blob/master/lts/16/10.yaml

Though I am not a stack authority.

juhp avatar Sep 06 '20 12:09 juhp

@saniac, I can only guess there is some mixed up in your enviroment because as you mentioned you had installed haskell-stack, which seems to contain stack 1.9.3 and then upgraded stack to 2.3.3. So you've two versions of stack. The former you could find with dpkg -L haskell-stack, the later presumably in .local/bin directory. If you haven't particular demand for haskell-stack, it could be helpful to purge it completely.

p-alik avatar Sep 06 '20 12:09 p-alik

Can confirm, purged Ubuntu Focal haskell-stack, verified stack running from ~/.local/bin is 2.3.3. Still fails.

saniac avatar Sep 08 '20 05:09 saniac

@saniac, the last option, I would suggest, is to remove content of ~/.stack directory because there could remain some settings of 1.9, which lead your 2.3 stack to use snapshot of deprecated former once and try again to install haskell-vim-now. If it doesn't help, I'll reopen issue https://github.com/commercialhaskell/stackage/issues/5615

p-alik avatar Sep 08 '20 07:09 p-alik

stephen@vivo:~$ rm -rf .stack/ stephen@vivo:~$ stack --version Version 2.3.3, Git revision cb44d51bed48b723a5deb08c3348c0b3ccfc437e x86_64 hpack-0.33.0 stephen@vivo:~$ ~/.config/haskell-vim-now/install.sh

...

Setting up GHC if needed... Stack setup failed with exit code: 1 stderr: stdout: *** setup_haskell.hs failed with error 1. *** Aborting...

Still happening I'm afraid. I can't exclude remnants of earlier efforts short of a clean install of this OS, but this is as close as I can get.

saniac avatar Sep 08 '20 09:09 saniac