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

build-depends on non-library packages should NOT cause executable to be built #3661

Closed
ezyang opened this issue Aug 2, 2016 · 4 comments
Closed

Comments

@ezyang
Copy link
Contributor

ezyang commented Aug 2, 2016

This post https://mail.haskell.org/pipermail/libraries/2013-August/020632.html suggests that Cabal allows you to build-depends on an executable-only package. But I don't think this works with cabal configure today:

ezyang@sabre:~/Dev/labs/yy$ cabal configure
Resolving dependencies...
Warning: solver failed to find a solution:
Could not resolve dependencies:
trying: yy-0.1.0.0 (user goal)
next goal: happy (dependency of yy-0.1.0.0)
Dependency tree exhaustively searched.
Trying configure anyway.
Configuring yy-0.1.0.0...
cabal: Encountered missing dependencies:
happy -any

However, dist-newstyle cheerfully accepts this, building happy and then failing to configure yy:

Configuring yy-0.1.0.0...
cabal: The following package dependencies were requested
--dependency='happy=happy-1.19.5-5f8b7690481a42bb40622b2bc299ce1c25547090f50356ea04e9c7b8658ec786'
however the given installed package instance does not exist.

So I think the mailing list post is wrong.

But what if we depend on a package that defines a library AND executable? I think we should be allowed to NOT build the executable. But this is inconsistent with current practice of defining a lib-exe package and then build-depends on it to get the exe built and installed. See #3417 where we're going to add some code to new-build to help handle this practice.

But this leads to a very annoying conclusion: we CAN'T ever skip building the executables of our build-depends dependencies, even in our world where we can pick in a fine-grained fashion which executables we want to build. Is there some feature flag we can set so users can opt into the more performant behavior? Should we just break people's code which relies on this and tell them to use build-tools?

@hvr
Copy link
Member

hvr commented Aug 2, 2016

Should we just break people's code which relies on this and tell them to use build-tools?

yes please! :-)

I don't think there'll be many packages breaking on hackage, and I certainly don't think we should support something that's morally wrong (or at the very least a technical debt) just for the sake of backward compat. We do have build-tools, let's use it properly already.

If as I think there's only a few packages suffering from this, we'll be able to .cabal-edit them on Hackage. We could also add a CLI flag to cabal-install to enable legacy-mode if there's demand for it.

@amigalemming
Copy link
Contributor

My first impression is also that the answer must be build-tools.

@ezyang ezyang changed the title What are the intended semantics of build-depends on non-library packages build-depends on non-library packages should NOT cause executable to be built Aug 16, 2016
@ezyang
Copy link
Contributor Author

ezyang commented Aug 16, 2016

If we fix this #3663 will get fixed automatically too.

@ezyang
Copy link
Contributor Author

ezyang commented Aug 24, 2016

Fixed!

@ezyang ezyang closed this as completed Aug 24, 2016
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