haskell / haskell/cabal

Non-buildable components don't work with new-build and pre-1.24 Custom setups

Open
#3,881 7 comments 0 reactions 0 assignees View on GitHub
cabal-install: v2-build system Cabal: stanza/custom-setup type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

So this is #3199 rearing its ugly head again, except for the `new-build` case. When a package has some non-buildable components (e.g. an exe that is disabled with default flag choice) **and** the build type is Custom **and** the setup script is built against Cabal < 1.24, the configure step will fail with an error like the following:

```
Configuring hpqtypes-1.5.1...
setup: At least the following dependencies are missing:
HUnit >=1.2,
QuickCheck >=2.5,
random >=1.0,
scientific -any,
test-framework >=0.8,
test-framework-hunit >=0.3,
unordered-containers -any
```

despite all these packages not actually being required for building the library.

In #3337 we fixed it for the old-build case by forcing a setup dependency on Cabal >= 1.24 when there's no custom-setup section. However, for new-build @dcoutts [wants to do something more clever](https://github.com/haskell/cabal/pull/3337#issuecomment-210857499) that'll still allow us to talk to old Cabal versions:

> But it's ok as a quick hack before the release I'd say [...], but it'd be good to try and make it possible to use older Cabal versions, since we do want to be able to have packages explicitly specify versions they work with (especially since we do want to start breaking the Cabal lib API to let us make bigger improvements). So we may need a proper fix to this in master at some point, and perhaps also consider making releases off of older branches that work with newer compiler versions.
>
> I'll have a think about what a fix that did allow us to talk to the older ones here would look like, for the new-build code path, where we know a bit more up front about what we want to do with the setup. I take @grayjay's point about this being tricky in the solver since we need to know both what version of Cabal will be used for Setup, and based on that decide if we include the "unnecessary" deps of non-buildable components.

A proper fix for this hasn't been implemented yet, so we may want to consider applying #3337 to the new-build code path as well as a (hopefully) temporary measure.

Contributor guide

Open the contributing guide

Research direction

Start by comparing the old-build fix in #3337 with the new-build configure and solver path described here, focusing on Custom setups using pre-1.24 Cabal. Done means non-buildable component dependencies are not required during configuration while compatibility with older Cabal versions is preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.