Skip to content

Don't try and resolve dependencies for packages that are not buildable #559

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

Closed
bos opened this issue May 24, 2012 · 4 comments
Closed

Don't try and resolve dependencies for packages that are not buildable #559

bos opened this issue May 24, 2012 · 4 comments

Comments

@bos
Copy link
Contributor

bos commented May 24, 2012

(Imported from Trac #566, reported by @batterseapower on 2009-07-03)

I had a component like this:

Executable edit-distance-benchmark
        Main-Is:                Text/EditDistance/Benchmark.hs
        if flag(splitBase)
                Build-Depends:  base >= 3 && < 5, array >= 0.1, random >= 1.0, old-time >= 1.0, process >= 1.0,
                                parallel >= 1.0, unix >= 2.3
        else
                Build-Depends:  base < 3,
                                parallel >= 1.0, unix >= 2.3
        if !flag(benchmark)
                Buildable:      False
        Ghc-Options:            -O2 -fvia-C -Wall
However, I've only just found out that this meant that you couldn't install any parts of my package on Windows, because Cabal tried to resolve the "unix" dependency even if "benchmark" was False (the default)!

I've solved this like so:

Executable edit-distance-benchmark
        Main-Is:                Text/EditDistance/Benchmark.hs
        if !flag(benchmark)
                Buildable:      False
        else
                if flag(splitBase)
                        Build-Depends:  base >= 3 && < 5, array >= 0.1, random >= 1.0, old-time >= 1.0, process >= 1.0,
                                        parallel >= 1.0, unix >= 2.3
                else
                        Build-Depends:  base < 3,
                                        parallel >= 1.0, unix >= 2.3
        Ghc-Options:            -O2 -fvia-C -Wall
But really Cabal should not need to resolve dependencies for things that are not buildable.
@bos
Copy link
Contributor Author

bos commented May 24, 2012

(Imported comment by @dcoutts on 2009-07-03)

The semantics for "buildable: False" is actually rather tricky. We don't have a precise description of what it should mean. See this discussion:
http://haskell.org/pipermail/glasgow-haskell-users/2009-December/018155.html

@yav
Copy link

yav commented Jun 26, 2012

I've also run into this problem and, having read the above e-mail, I don't really see a difficulty with the semantics of "Buildable". Here's how I'd expect things to work:

  1. Figure out the flags for a package (based on user-specified flags and defaults)
  2. Using the flags (and other environment variables) resolve all conditionals, eliminating them from the Cabal file
  3. Remove all parts where "Buildable: False" appears.
  4. Resolve dependencies as usual.

@letmaik
Copy link

letmaik commented Nov 9, 2012

I second yav's reasoning. I stumbled across this today and find it really confusing.

@ttuegel
Copy link
Member

ttuegel commented Feb 28, 2015

This is a duplicate of #1725.

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

4 participants