Repository navigation
Description
A minimal example repository is here. This issue came up in the context of the cuda package.
Steps to reproduce:
- git clone https://github.com/tmcdonell/stack-bug
- stack build
Expected:
Build succeeds.
Actual:
Build fails.
> stack build
stack-bug-0.1.0.0: configure
/Users/trevor/Dropbox/Projects/stack-bug/Setup.hs:2:42:
Module
‘Distribution.PackageDescription’
does not export
‘extraGHCiLibs’
-- While building package stack-bug-0.1.0.0 using:
/usr/local/bin/runhaskell -package=Cabal-1.18.1.5 -clear-package-db -global-package-db -package-db=/Users/trevor/.stack/snapshots/x86_64-osx/lts-2.22/7.8.4/pkgdb/ /Users/trevor/Dropbox/Projects/stack-bug/Setup.hs --builddir=.stack-work/dist/x86_64-osx/Cabal-1.18.1.5/ configure --user --package-db=clear --package-db=global --package-db=/Users/trevor/.stack/snapshots/x86_64-osx/lts-2.22/7.8.4/pkgdb/ --package-db=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/pkgdb/ --libdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/lib --bindir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/bin --datadir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/share --libexecdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/libexec --sysconfdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/etc --docdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/doc/stack-bug-0.1.0.0 --htmldir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/doc/stack-bug-0.1.0.0 --haddockdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/doc/stack-bug-0.1.0.0 --constraint=Cabal==1.22.4.0 --constraint=base==4.7.0.2 --enable-tests --enable-benchmarks
Process exited with code: ExitFailure 1
stack uses the version of the Cabal library that comes with the selected resolver, even if the package specifies that a newer version is required. In the example, stack is configured to build with ghc-7.8. The Setup.hs file requires Cabal-1.22, which we have specified in both the cabal-version and build-depends fields of the .cabal file, and put that as an extra-deps in stack.yaml.
Note in the output above, stack does mention both versions of the Cabal library. I am guessing that the second comes from the listing Cabal as a dependency, and the first is incorrectly not respecting the cabal-version requirement.
-- While building package stack-bug-0.1.0.0 using:
/usr/local/bin/runhaskell -package=Cabal-1.18.1.5 <snip> --constraint=Cabal==1.22.4.0 ...
The package does successfully install using cabal-install
Here is the stack --version output:
Version 0.1.4.0, Git revision dac8cfe51802e08edb523b80c51cf35e21933513 (1722 commits) X86_64
Here is the output of stack build --verbose:
Version 0.1.4.0, Git revision dac8cfe51802e08edb523b80c51cf35e21933513 (1722 commits) X86_64
2015-09-20 20:31:25.352142: [debug] Checking for project config at: /Users/trevor/Dropbox/Projects/stack-bug/stack.yaml @(stack_256QTnIkPXj66qDsz01mSu:Stack.Config src/Stack/Config.hs:466:9)
2015-09-20 20:31:25.352438: [debug] Loading project config file stack.yaml @(stack_256QTnIkPXj66qDsz01mSu:Stack.Config src/Stack/Config.hs:489:13)
2015-09-20 20:31:25.353257: [debug] Trying to decode /Users/trevor/.stack/build-plan-cache/x86_64-osx/lts-2.22.cache @(stack_256QTnIkPXj66qDsz01mSu:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:77:5)
2015-09-20 20:31:25.357917: [debug] Success decoding /Users/trevor/.stack/build-plan-cache/x86_64-osx/lts-2.22.cache @(stack_256QTnIkPXj66qDsz01mSu:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:86:13)
2015-09-20 20:31:25.358172: [debug] Run process: ghc --info @(stack_256QTnIkPXj66qDsz01mSu:System.Process.Read src/System/Process/Read.hs:260:3)
2015-09-20 20:31:25.418516: [debug] Run process: ghc --numeric-version @(stack_256QTnIkPXj66qDsz01mSu:System.Process.Read src/System/Process/Read.hs:260:3)
2015-09-20 20:31:25.455326: [debug] Run process: ghc-pkg --no-user-package-db field --simple-output Cabal id @(stack_256QTnIkPXj66qDsz01mSu:System.Process.Read src/System/Process/Read.hs:260:3)
2015-09-20 20:31:25.483767: [debug] Run process: ghc-pkg --no-user-package-db list --global @(stack_256QTnIkPXj66qDsz01mSu:System.Process.Read src/System/Process/Read.hs:260:3)
2015-09-20 20:31:25.514515: [debug] Checking resolver: lts-2.22 @(stack_256QTnIkPXj66qDsz01mSu:Stack.Build.Source src/Stack/Build/Source.hs:162:17)
2015-09-20 20:31:25.514636: [debug] Trying to decode /Users/trevor/.stack/build-plan-cache/x86_64-osx/lts-2.22.cache @(stack_256QTnIkPXj66qDsz01mSu:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:77:5)
2015-09-20 20:31:25.518522: [debug] Success decoding /Users/trevor/.stack/build-plan-cache/x86_64-osx/lts-2.22.cache @(stack_256QTnIkPXj66qDsz01mSu:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:86:13)
2015-09-20 20:31:25.51995: [debug] Trying to decode /Users/trevor/.stack/indices/Hackage/00-index.cache @(stack_256QTnIkPXj66qDsz01mSu:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:77:5)
2015-09-20 20:31:25.811103: [debug] Success decoding /Users/trevor/.stack/indices/Hackage/00-index.cache @(stack_256QTnIkPXj66qDsz01mSu:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:86:13)
2015-09-20 20:31:25.81298: [debug] Run process: ghc-pkg --global --no-user-package-db dump --expand-pkgroot @(stack_256QTnIkPXj66qDsz01mSu:System.Process.Read src/System/Process/Read.hs:260:3)
2015-09-20 20:31:25.858329: [debug] Run process: ghc-pkg --user --no-user-package-db --package-db /Users/trevor/.stack/snapshots/x86_64-osx/lts-2.22/7.8.4/pkgdb/ dump --expand-pkgroot @(stack_256QTnIkPXj66qDsz01mSu:System.Process.Read src/System/Process/Read.hs:260:3)
2015-09-20 20:31:25.900812: [debug] Run process: ghc-pkg --user --no-user-package-db --package-db /Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/pkgdb/ dump --expand-pkgroot @(stack_256QTnIkPXj66qDsz01mSu:System.Process.Read src/System/Process/Read.hs:260:3)
2015-09-20 20:31:25.924967: [debug] Trying to decode /Users/trevor/.stack/indices/Hackage/00-index.cache @(stack_256QTnIkPXj66qDsz01mSu:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:77:5)
2015-09-20 20:31:26.162822: [debug] Success decoding /Users/trevor/.stack/indices/Hackage/00-index.cache @(stack_256QTnIkPXj66qDsz01mSu:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:86:13)
2015-09-20 20:31:26.162977: [debug] Trying to decode /Users/trevor/.stack/indices/Hackage/00-index.cache @(stack_256QTnIkPXj66qDsz01mSu:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:77:5)
2015-09-20 20:31:26.400382: [debug] Success decoding /Users/trevor/.stack/indices/Hackage/00-index.cache @(stack_256QTnIkPXj66qDsz01mSu:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:86:13)
2015-09-20 20:31:26.503348: [debug] All installs are local; releasing snapshot lock early. @(stack_256QTnIkPXj66qDsz01mSu:Stack.Build src/Stack/Build.hs:92:28)
2015-09-20 20:31:26.50397: [debug] Run process: ghc-pkg --no-user-package-db list --global @(stack_256QTnIkPXj66qDsz01mSu:System.Process.Read src/System/Process/Read.hs:260:3)
2015-09-20 20:31:26.535263: [info] stack-bug-0.1.0.0: configure @(stack_256QTnIkPXj66qDsz01mSu:Stack.Build.Execute src/Stack/Build/Execute.hs:587:23)
2015-09-20 20:31:26.53572: [debug] Run process: /usr/local/bin/runhaskell -package=Cabal-1.18.1.5 -clear-package-db -global-package-db -package-db=/Users/trevor/.stack/snapshots/x86_64-osx/lts-2.22/7.8.4/pkgdb/ /Users/trevor/Dropbox/Projects/stack-bug/Setup.hs --builddir=.stack-work/dist/x86_64-osx/Cabal-1.18.1.5/ configure --user --package-db=clear --package-db=global --package-db=/Users/trevor/.stack/snapshots/x86_64-osx/lts-2.22/7.8.4/pkgdb/ --package-db=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/pkgdb/ --libdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/lib --bindir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/bin --datadir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/share --libexecdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/libexec --sysconfdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/etc --docdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/doc/stack-bug-0.1.0.0 --htmldir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/doc/stack-bug-0.1.0.0 --haddockdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/doc/stack-bug-0.1.0.0 --constraint=Cabal==1.22.4.0 --constraint=base==4.7.0.2 --enable-tests --enable-benchmarks @(stack_256QTnIkPXj66qDsz01mSu:Stack.Build.Execute src/Stack/Build/Execute.hs:696:21)
2015-09-20 20:31:26.761829: [warn] @(stack_256QTnIkPXj66qDsz01mSu:Stack.Build.Execute src/Stack/Build/Execute.hs:1175:35)
2015-09-20 20:31:26.76196: [warn] /Users/trevor/Dropbox/Projects/stack-bug/Setup.hs:2:42: @(stack_256QTnIkPXj66qDsz01mSu:Stack.Build.Execute src/Stack/Build/Execute.hs:1175:35)
2015-09-20 20:31:26.762017: [warn] Module @(stack_256QTnIkPXj66qDsz01mSu:Stack.Build.Execute src/Stack/Build/Execute.hs:1175:35)
2015-09-20 20:31:26.762158: [warn] ‘Distribution.PackageDescription’ @(stack_256QTnIkPXj66qDsz01mSu:Stack.Build.Execute src/Stack/Build/Execute.hs:1175:35)
2015-09-20 20:31:26.762397: [warn] does not export @(stack_256QTnIkPXj66qDsz01mSu:Stack.Build.Execute src/Stack/Build/Execute.hs:1175:35)
2015-09-20 20:31:26.762471: [warn] ‘extraGHCiLibs’ @(stack_256QTnIkPXj66qDsz01mSu:Stack.Build.Execute src/Stack/Build/Execute.hs:1175:35)
-- While building package stack-bug-0.1.0.0 using:
/usr/local/bin/runhaskell -package=Cabal-1.18.1.5 -clear-package-db -global-package-db -package-db=/Users/trevor/.stack/snapshots/x86_64-osx/lts-2.22/7.8.4/pkgdb/ /Users/trevor/Dropbox/Projects/stack-bug/Setup.hs --builddir=.stack-work/dist/x86_64-osx/Cabal-1.18.1.5/ configure --user --package-db=clear --package-db=global --package-db=/Users/trevor/.stack/snapshots/x86_64-osx/lts-2.22/7.8.4/pkgdb/ --package-db=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/pkgdb/ --libdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/lib --bindir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/bin --datadir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/share --libexecdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/libexec --sysconfdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/etc --docdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/doc/stack-bug-0.1.0.0 --htmldir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/doc/stack-bug-0.1.0.0 --haddockdir=/Users/trevor/Dropbox/Projects/stack-bug/.stack-work/install/x86_64-osx/lts-2.22/7.8.4/doc/stack-bug-0.1.0.0 --constraint=Cabal==1.22.4.0 --constraint=base==4.7.0.2 --enable-tests --enable-benchmarks
Process exited with code: ExitFailure 1
Activity
snoyberg commentedon Sep 21, 2015
When you say it works with cabal-install, do you mean that running cabal will automatically install a new version of the Cabal library for you? I'm unaware of that functionality, Setup.hs dependencies are not properly supported in the cabal spec yet.
The command in stack to upgrade your cabal library version is
stack setup --upgrade-cabal. Can you give that a shot?tmcdonell commentedon Sep 21, 2015
Correct, cabal-install does not automatically install the new version of the Cabal library. Putting it as an explicit dependency was a small hack to force that to happen. So what I meant is that, the following sequence succeeds with the example repo:
Result of running
stack setup --upgrade-cabal --verbose: https://gist.github.com/tmcdonell/77206de4cdf4cbf4814bNamely:
In case it is relevant, I'm using a system installed version of ghc, but that is in
/Library/Frameworks/GHC.framework/Versions/*, not in/usr/local.Ah, actually I do have symlinks in
/usr/local/binthat then point to the "current" version. So, I guess stack is not taking the canonical path?Maybe I should submit this as a separate issue?
Anyway, if I make
/usr/localwritable, thenstack setup --upgrade-cabalsucceeds and so doesstack build, even after I remove the hack of explicitly adding the Cabal library as a dependency. Whoo!Cabal-install warns if the right version of
Caballibrary isn't available (then continues anyway to inevitable failure). Canstackdo a similar check, and then either (a) stop and issue thestack setup --upgrade-cabalinstructions; or (b) go ahead and do the upgrade automatically (is that dangerous?).snoyberg commentedon Sep 21, 2015
If you look in the output log, you should have received a warning about upgrading Cabal in a system-installed GHC, much for the reasons you just mentioned. I don't think there's any bug there.
In theory, I'm OK with the error message about the Cabal version. However, this is actually a misuse of the field: cabal-version (at least according to the API docs) is about the version of the Cabal specification, not the Cabal library. I don't know that those are the same thing.
tmcdonell commentedon Sep 22, 2015
Yes, I do see the warning that upgrading Cabal with a system installed GHC may fail. But, couldn't this be installed into
$HOME/.stacksomewhere, rather than in the system paths (which is likely to fail)?I'm also not sure whether the cabal-version field implies a Cabal library version. Perhaps this is why the cabal-install tool only issues a warning and continues anyway (and inevitably fails). But, currently stack issues no warning and fails, so while both these situations are less than ideal, stack isn't giving any hints about what to do to fix it.
snoyberg commentedon Sep 29, 2015
Where we install the Cabal library is quite a separate issue. We can consider such a change, but given the corner case we're addressing with it, I'll likely ask for a PR. If you're interested in undertaking that, great!
OK, I'll agree that a warning when the cabal-version field is greater than the Cabal library version is a good call. Similar to my previous comment: interested in taking a stab at a PR on this?
tmcdonell commentedon Sep 29, 2015
Sure, I'll take a stab at those.
(It will be a little while before I get to that though, currently quite ill)
snoyberg commentedon Sep 29, 2015
Oh, I'm sorry to hear that, feel better soon!
On Tue, Sep 29, 2015 at 5:38 PM, Trevor L. McDonell <
[email protected]> wrote:
davidsd commentedon Oct 10, 2015
I am currently trying to use a github-hosted package (https://github.com/ekmett/rounded, actually a forked version https://github.com/davidsd/rounded) with stack. But it requires both ghc <= 7.8.4 and Cabal > 1.20 (there is a custom Setup.hs for building c-code, hence the specialized Cabal requirement). However, no such resolver exists. What's my best course of action?
snoyberg commentedon Oct 11, 2015
You can upgrade your installed cabal version with stack setup
--upgrade-cabal. However, further discussion on that should go on
elsewhere, it doesn't look directly related to the feature request here
On Sun, Oct 11, 2015, 2:12 AM David Simmons-Duffin [email protected]
wrote:
mgsloan commentedon Mar 8, 2017
This is a rather old discussion, closing. Stack now supports custom-setup deps!