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

Mismatch between old and new buildable: False behavior #4983

Closed
snoyberg opened this issue Dec 29, 2017 · 2 comments
Closed

Mismatch between old and new buildable: False behavior #4983

snoyberg opened this issue Dec 29, 2017 · 2 comments

Comments

@snoyberg
Copy link
Collaborator

There was an issue that affected (IIRC) Cabal < 1.24 where dependencies for components with buildable: False still appeared in the dependency graph (#1725). That behavior has been fixed in Cabal (both the library and the build tool). However, if you attempt to use a custom build with Cabal-1.22.* and a newer cabal-install, this can lead to a failed build. As an example:

$ cabal --version
cabal-install version 2.0.0.1
compiled using version 2.0.1.1 of the Cabal library 
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.3
$ cat Setup.hs 
import Distribution.Simple
main = defaultMain
$ cat buildable-false.cabal
name: buildable-false
version: 0
cabal-version: 1.22
build-type: Custom

custom-setup
  setup-depends: base, Cabal == 1.22.*

library
  build-depends: base == 4.8.*

executable not-buildable
  buildable: False
  main-is: Main.hs
  build-depends: base, mtl
$ cabal install
Resolving dependencies...
Configuring buildable-false-0...
Failed to install buildable-false-0
Build log ( /Users/michael/.cabal/logs/ghc-7.10.3/buildable-false-0-wJsafUtWQF4L316LjxRnF.log ):
cabal: Entering directory '.'
[1 of 1] Compiling Main             ( dist/setup/setup.hs, dist/setup/Main.o )
Linking ./dist/setup/setup ...
Warning: buildable-false.cabal: Ignoring unknown section type: custom-setup
Configuring buildable-false-0...
setup: At least the following dependencies are missing:
mtl -any
cabal: Leaving directory '.'
cabal: Error: some packages failed to install:
buildable-false-0-wJsafUtWQF4L316LjxRnF failed during the configure step. The
exception was:
ExitFailure 1

This appears to affect new-build as well:

$ cabal new-build
Resolving dependencies...
In order, the following will be built (use -v for more details):
 - buildable-false-0 (lib:buildable-false) (first run)
[1 of 1] Compiling Main             ( /Users/michael/Desktop/buildable-false/dist-newstyle/build/x86_64-osx/ghc-7.10.3/buildable-false-0/setup/setup.hs, /Users/michael/Desktop/buildable-false/dist-newstyle/build/x86_64-osx/ghc-7.10.3/buildable-false-0/setup/Main.o )
Linking /Users/michael/Desktop/buildable-false/dist-newstyle/build/x86_64-osx/ghc-7.10.3/buildable-false-0/setup/setup ...
Warning: buildable-false.cabal: Ignoring unknown section type: custom-setup
Configuring buildable-false-0...
setup: At least the following dependencies are missing:
mtl -any

I'm opening this issue as it affected Stack 1.6.1, and we needed to work around it. The situation is more likely to appear with Stack than with cabal-install, since Stackage snapshots will usually specify older Cabal library versions. But the situation can certainly appear with a cabal-install workflow too. Our resolution was to add logic to detect if an older Cabal library was being used, and then revert to the old (buggy) behavior of including dependencies of buildable: False components.

@ezyang
Copy link
Contributor

ezyang commented Dec 29, 2017

Seems related to #3881

Edit: Actually, looks like a dupe. @snoyberg, would you agree?

@grayjay
Copy link
Collaborator

grayjay commented Jan 12, 2018

I think this is a duplicate of #3881.

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

No branches or pull requests

3 participants