Idris-dev icon indicating copy to clipboard operation
Idris-dev copied to clipboard

stack-alt.yaml doesn't work with latest (2.1.3) Stack

Open Martin-F opened this issue 5 years ago • 4 comments

I've been trying to build Idris with Stack, and encountered the "Issue with GHC on Ubuntu/Fedora" described in INSTALL.md - but when I tried to follow the work-around instructions there, they didn't work:

Steps to Reproduce

stack upgrade
stack unpack idris
cd idris-1.3.2
mv stack-alt.yaml stack.yaml
stack build

Expected Behavior

Stack compiles Idris successfully.

Observed Behavior

It fails almost immediately, with

Aeson exception: Error in $.packages[0]: failed to parse field 'packages': expected Text, encountered Object

A Tentative Diagnosis

This is the packages clause in stack-alt.yaml that Stack's complaining about:

packages:
  - location: .

So, having done some reading, I think this change in Stack is the cause of the problem:

NOTE Beginning with Stack 1.11, Stack has moved over to Pantry for managing extra-deps, and has removed some legacy syntax for specifying dependencies in packages. [...] Legacy syntax Prior to Stack 1.11, it was possible to specify dependencies in your packages configuration value as well. This support has been removed to simplify the file format. Instead, these values should be moved to extra-deps.

A Proposed Solution

I noticed that Stack documentation also says this:

The packages field is optional. If omitted, it is treated as:

packages:
  - .

And, figuring that that default looked awfully like it'd mean the same thing as the one in stack-alt.yaml, I thought I'd try deleting the packages clause from stack-alt.yaml entirely & see what happened.

That got me... a new error!

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for Cabal-2.2.0.1:
    binary must match >=0.7 && <0.9, but the stack configuration has no specified version  (latest matching version is 0.8.8.0)
needed due to idris-1.3.2 -> Cabal-2.2.0.1

In the dependencies for idris-1.3.2(+ffi +gmp):
    binary must match >=0.8.4.1 && <0.9, but the stack configuration has no specified version  (latest matching version is 0.8.8.0)
needed since idris is a build target.

In the dependencies for scientific-0.3.5.3:
    binary must match >=0.4.1, but the stack configuration has no specified version  (latest matching version is 0.8.8.0)
needed due to idris-1.3.2 -> scientific-0.3.5.3

In the dependencies for text-1.2.3.0(-integer-simple):
    binary needed, but the stack configuration has no specified version  (latest matching version is 0.8.8.0)
needed due to idris-1.3.2 -> text-1.2.3.0

In the dependencies for uuid-types-1.0.3:
    binary must match >=0.4 && <0.9, but the stack configuration has no specified version  (latest matching version is 0.8.8.0)
needed due to idris-1.3.2 -> uuid-types-1.0.3

In the dependencies for vector-binary-instances-0.2.4:
    binary must match >=0.5 && <0.10, but the stack configuration has no specified version  (latest matching version is 0.8.8.0)
needed due to idris-1.3.2 -> vector-binary-instances-0.2.4

In the dependencies for zip-archive-0.3.3:
    binary must match >=0.6, but the stack configuration has no specified version  (latest matching version is 0.8.8.0)
needed due to idris-1.3.2 -> zip-archive-0.3.3

Some different approaches to resolving this:

  * Recommended action: try adding the following to your extra-deps in [...]/idris-1.3.2/stack.yaml:

- binary-0.8.8.0@sha256:e9387a7ef2b34c6a23b09664c306e37cc01ae2cb4e4511a1c96ffb14008c24b0,6262

Now, I don't really know what that "recommended action" suggested there does, but I figured I'd blindly follow the instructions anyway. And... it worked! I now have a copy of Idris I compiled myself :)

So I figure those changes to stack-alt.yaml should probably be made in the repo: removing the packages clause, and adding that line for binary to extra-deps. But I don't know enough about Stack nor Idris to know if there'd be any adverse knock-on effects, so I thought I'd be better off raising a ticket than a pull request - and let someone who actually knows what they're doing take it from here.

Martin-F avatar Feb 10 '20 21:02 Martin-F

Sorry for the late response.

Please do add a PR with your proposed changes! It would be a nice first step to helping with Idris development.

jfdm avatar Mar 04 '20 12:03 jfdm

This got resolved in #4827

ilyakooo0 avatar Mar 20 '20 12:03 ilyakooo0

@Martin-F if this satisfies your needs, could we close this issue?

jfdm avatar Mar 31 '20 14:03 jfdm

@jfdm seems likely, but I'd have to try another build to check. Has that change made its way onto Stackage yet?

If not, could you describe the process I'd need to follow to do a test build incorporating the change? I'm guessing it'd start with "pull master from github", but I don't know where I'd go from there.

Martin-F avatar Apr 02 '20 09:04 Martin-F