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

Stack build error: AesonException #2759

Closed
kgadek opened this issue Aug 15, 2017 · 16 comments
Closed

Stack build error: AesonException #2759

kgadek opened this issue Aug 15, 2017 · 16 comments

Comments

@kgadek
Copy link

kgadek commented Aug 15, 2017

I believe there's problem with recent nightlies.

resolver: nightly-2017-08-14
packages: 
- '.'
flags: {}
extra-package-dbs: []
Downloaded nightly-2017-08-14 build plan.
AesonException "Error in $.packages.cassava.constraints.flags['bytestring--lt-0_10_4']: Invalid flag name: \"bytestring--lt-0_10_4\""

However, if I use nightly-2017-08-12 then everything works. Or is it stack problem? (1.5.1 x86_64 hpack-0.17.1)


The only mention of anything related to error message is build-constraints.yaml:3375:

# Package flags are applied to individual packages, and override the values of
# global-flags
package-flags:

    # …snip to line 3375…

    cassava:
        pre-bytestring-0-10-4: false

I looked into my nightly-2017-08-14.yaml and replaced bytestring--lt-0_10_4: false with pre-bytestring-0-10-4: false. That fixed the problem. Changing bytestring--lt-0_10_4: falsebytestring-lt-0_10_4: false also solves the initial problem.


I've also found that stack with --flag cassava:-bytestring--lt-0_10_4 yields:

option --flag: Invalid flag name: bytestring--lt-0_10_4

stack from HEAD fixes the problem and — per discussion — it appears that this will get fixed soon. Not sure if I should close the ticket

@snoyberg
Copy link
Contributor

Thanks for opening the ticket. The next nightly release will fix this by moving back to the older cassava. And as you noted, Stack's HEAD fixes this by doing no flag name validation (yay?).

tfausak added a commit to tfausak/cassava that referenced this issue Sep 8, 2017
This flag name was changed without comment in 6e1ff78. It has caused a few problems:

- commercialhaskell/stack#3345
- commercialhaskell/stackage#2755
- commercialhaskell/stackage#2759
- commercialhaskell/stackage#2842
- haskell/cabal#4686
- haskell-hvr#150

Those problems either caused or accelerated some (attempted) changes in Cabal:

- haskell/cabal#4654
- haskell/cabal#4687
- haskell/cabal#4696

Those problems also caused a change in Stack:

- commercialhaskell/stack#3349

In short: Cabal never had any trouble with this. Stack did. The current master version of Stack can handle flags like this, but no released versions of it can. It's not clear when the next version of Stack will be released. In the meantime, no Stack users can use this package. This commit changes the offending flag to something that Stack can handle. By using a flag that Stack can handle, Stack users can once again use this package, and it can return to Stackage. There are no apparent downsides to using a more compatible flag name.
@austinvhuang
Copy link

The issue seems to have returned, possibly with a newer cassava in a more recent LTS:

$ stack new ghc-memory simple
stack new ghc-memory simple
Downloading template "simple" to create project "ghc-memory" in ghc-memory/ ...

The following parameters were needed by the template but not provided: author-email, author-name, category, copyright, github-username
You can provide them in /Users/huanga13/.stack/config.yaml, like this:
templates:
  params:
    author-email: value
    author-name: value
    category: value
    copyright: value
    github-username: value
Or you can pass each one as parameters like this:
stack new ghc-memory simple -p "author-email:value" -p "author-name:value" -p "category:value" -p "copyright:value" -p "github-username:value"

Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- ghc-memory/ghc-memory.cabal

Selecting the best among 12 snapshots...

Downloaded lts-10.0 build plan.
AesonException "Error in $.packages.cassava.constraints.flags['bytestring--lt-0_10_4']: Invalid flag name: \"bytestring--lt-0_10_4\""

@snoyberg
Copy link
Contributor

snoyberg commented Dec 21, 2017 via email

@austinvhuang
Copy link

Resolved thanks.

@denisgrib
Copy link

denisgrib commented Feb 20, 2018

On ubuntu also after
stack upgrade

stack setup         
                                                                                                                                                                                   
Run from outside a project, using implicit global project config
Using resolver: lts-10.5 from implicit global project's config file: /home/xxx/.stack/global-project/stack.yaml
Downloaded lts-10.5 build plan.    
AesonException "Invalid flag name: \"bytestring--lt-0_10_4\""

@bergmark
Copy link
Member

@Spaceblock you probably have the old stack in your PATH, the new one should be in ~/.local/bin.

@denisgrib
Copy link

denisgrib commented Feb 20, 2018

@bergmark

> $ where stack                                                                                                                                                                                            
/usr/bin/stack

> $ /usr/bin/stack --version                                                                                                                                                                               
Version 0.1.10.0 x86_64
> $ /usr/bin/stack upgrade                                                                                                                                                                                 
Fetched package index.                                                                                    
Populated index cache.    
Could not parse '/tmp/stack-upgrade9644/stack-1.6.5/stack.yaml':
AesonException "failed to parse field 'extra-deps': when expecting a PackageIdentifier, encountered Object instead"
See https://github.com/commercialhaskell/stack/blob/release/doc/yaml_configuration.md.

@bergmark
Copy link
Member

Right, that seems to verify the path issue, 0.1.10.0 is too old.

@bergmark
Copy link
Member

Sorry, I misread the error. I'm not sure how to resolve that one... But you could always get the binary as described in https://docs.haskellstack.org/en/stable/README/

@denisgrib
Copy link

denisgrib commented Feb 20, 2018

@bergmark thx, installed from curl -sSL https://get.haskellstack.org/ | sh
in ubuntu too old package.

@QLaille
Copy link

QLaille commented Apr 26, 2018

Still an issue for me, even after forcing the reinstallation with curl -sSL https://get.haskellstack.org/ | sh -s - -f
Same setup, and same issues as @Spaceblock , I'm kinda lost now
image

@bergmark
Copy link
Member

@QLaille looks like the old stack is still in your PATH, is the new one in ~./local/bin?

@QLaille
Copy link

QLaille commented Apr 26, 2018

@bergmark Negative, there's nothing related to stack in there, what should I do ?
image

@QLaille
Copy link

QLaille commented Apr 30, 2018

After trying to move stack in ~/.local/bin , it appears to be quite the same, not sure if I'm doing it wrong

image

@juhp
Copy link
Contributor

juhp commented Apr 30, 2018

What does stack --version say now?

@QLaille
Copy link

QLaille commented May 1, 2018

After re-installing stack via cabal install stack it was successfully installed on my ~/.local/bin folder, I forgot to answer back !

EDIT: What I conclude is that trying to install stack via the ubuntu package or manually via the command line, stack keeps being installed in the /usr/bin/ path, while cabal itself could install it to the appropriated folder, i'm quite clueless about what I did and if something is wrong in the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants