Closed nponeccop closed 7 years ago
The issue is likely that you have an older version of cabal-install installed. Check cabal --version
. I have 1.24.0.1 and it works as expected:
The following changes will be made to stack.yaml:
* Dependencies to be added
extra-deps:
- acme-missiles-0.3
In https://github.com/commercialhaskell/stack/commit/38f67e8403b55cbf5c46ce0c7e0bbeadaf4e1fed I've added the following warning to make this clearer:
Warning: Installed version of cabal-install (1.22.9.0) doesn't support custom-setup clause, and so may not yield correct results.
To resolve this, install a newer version via 'stack install cabal-install'.
I have
$ cabal --version
cabal-install version 1.24.0.0
And it doesn't work in current HEAD (after your commit):
$ stack --version | head -n 3
Version 1.4.1, Git revision 38f67e8403b55cbf5c46ce0c7e0bbeadaf4e1fed (4639 commits) i386
Compiled with:
- Cabal-1.24.2.0
To be clear I have the following Setup.hs
(Acme.Missiles
is only imported from Setup.hs
and not from elsewhere):
import Distribution.Simple
import Acme.Missiles
main = defaultMain
And the following stack.yaml
:
resolver: lts-8.3
(Although it doesn't work with stack.yaml
generated by stack new
either)
I get the following during stack solver
)
$ stack solver
Using configuration file: stack.yaml
Using cabal packages:
- setup-depends.cabal
No changes needed to stack.yaml
And the following during stack build
:
$ stack build
Warning: File listed in setup-depends.cabal file does not exist: README.md
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for setup-depends-0.1.0.0:
acme-missiles must match -any, but the stack configuration has no specified version (latest applicable is 0.3)
Recommended action: try adding the following to your extra-deps in /home/andy/dev/setup-depends/stack.yaml:
- acme-missiles-0.3
You may also want to try the 'stack solver' command
Plan construction failed.
I've just installed the latest cabal-install
with no improvement:
$ env PATH=/home/andy/.local/bin:/bin cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library
$ env PATH=/home/andy/.local/bin:/bin stack solver
Using configuration file: stack.yaml
Using cabal packages:
- setup-depends.cabal
However my stack
is built using lts-8.3
and ghc-8.0.2
, could that be a source of problems? This is how I built the stack itself (using binary 1.3.1 from my dist for bootstrapping):
stack build --no-system-ghc --stack-yaml stack-8.0.yaml --resolver lts-8.3 --compiler ghc-8.0.2 --install-ghc
Hmm, strange! Re-opening as need repro
However my stack is built using lts-8.3 and ghc-8.0.2, could that be a source of problems?
Shouldn't be an issue, but I suppose it's worth a shot using just the standard stack.yaml
config.
Rebuild with stack.yaml:
$ stack --version --verbose
Version 1.4.1, Git revision 48b1cddae255327eedf1fb8dd6296d4f72a7fdc6 (4646 commits) i386 hpack-0.17.0
Still the same problem. How can I help reproduce? Or investigate the problem myself
Ahah! I think I figured it out. It skips running the solver if all the deps are contained in the snapshot. It was using functions that didn't count setup dependencies as dependencies of the package. The resolution to http://github.com/fpco/stack/issues/3035 fixes this problem as well.
It was merged back to master quite recently, after the commit that you're on. So I believe this should now be fixed!
Works for me too, good job!
$ stack solver
Using configuration file: stack.yaml
Using cabal packages:
- setup-depends.cabal
Using resolver: lts-8.3
Using compiler: ghc-8.0.2
Asking cabal to calculate a build plan...
Trying with packages from lts-8.3 as hard constraints...
Successfully determined a build plan with 1 external dependencies.
The following changes will be made to stack.yaml:
* Dependencies to be added
extra-deps:
- acme-missiles-0.3
To automatically update stack.yaml, rerun with '--update-config'
BTW stack itself builds just fine with LTS-8.4
General summary/comments (optional)
When building a package with setup-depends dependency which is not in the snapshot, stack solver reports no problems but subsequent builds recommend adding an extra-dep.
Steps to reproduce
acme-missiles-0.3
as anextra-dep
stack solver
.Expected
acme-missiles-0.3 is recommended
Actual
It says stack.yaml is ok
Stack version
Method of installation