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

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

Open
23Skidoo opened this issue Sep 21, 2016 · 8 comments

Comments

@23Skidoo
Copy link
Member

23Skidoo commented Sep 21, 2016

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 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.

23Skidoo added a commit to scrive/hpqtypes that referenced this issue Sep 21, 2016
@ezyang
Copy link
Contributor

ezyang commented Sep 21, 2016

@23Skidoo Do you think this is a blocker for the 2.0 release.

@23Skidoo
Copy link
Member Author

I do not, since nix-local-build will still be a technical preview. But I can probably port #3337 to the new code path in time for 2.0 if we decide to go that route.

@ezyang
Copy link
Contributor

ezyang commented Sep 21, 2016

I just want it to work correctly ;) (And #3337 doesn't make it work correctly in all cases :( )

@dcoutts
Copy link
Contributor

dcoutts commented Sep 22, 2016

Mm, I'm not sure we can work around this one in older Cabal lib versions. The configure step checks for all those deps. So we either have to force a later Cabal lib version or do some egregious hack (e.g. tell it to use an additional package db with fake instances for the required "unused" deps).

@grayjay
Copy link
Collaborator

grayjay commented Mar 12, 2017

There is more discussion of this issue in #4148.

@grayjay
Copy link
Collaborator

grayjay commented Jan 12, 2018

#4983 has an example that fails with old and new build because the custom-setup section specifies a pre-1.24 Cabal version.

@hvr hvr added the meta: hvr label Aug 12, 2018
@phadej phadej modified the milestones: 3.0.1.0, 3.4 Nov 27, 2019
sjakobi added a commit to sjakobi/pretty-simple that referenced this issue Dec 2, 2019
Previously I would see the following build failure:

    $ cabal-3.0 build -w ghc-7.10.3
    Resolving dependencies...
    Build profile: -w ghc-7.10.3 -O1
    In order, the following will be built (use -v for more details):
     - pretty-simple-3.1.0.0 (lib:pretty-simple) (first run)
    Warning: pretty-simple.cabal: Ignoring unknown section type: custom-setup
    Configuring pretty-simple-3.1.0.0...
    setup: At least the following dependencies are missing:
    aeson -any, bytestring -any, optparse-applicative -any

haskell/cabal#3881 seems related but
I don't fully understand the issue.
cdepillabout pushed a commit to cdepillabout/pretty-simple that referenced this issue Dec 2, 2019
Previously I would see the following build failure:

    $ cabal-3.0 build -w ghc-7.10.3
    Resolving dependencies...
    Build profile: -w ghc-7.10.3 -O1
    In order, the following will be built (use -v for more details):
     - pretty-simple-3.1.0.0 (lib:pretty-simple) (first run)
    Warning: pretty-simple.cabal: Ignoring unknown section type: custom-setup
    Configuring pretty-simple-3.1.0.0...
    setup: At least the following dependencies are missing:
    aeson -any, bytestring -any, optparse-applicative -any

haskell/cabal#3881 seems related but
I don't fully understand the issue.
@Mikolaj
Copy link
Member

Mikolaj commented Aug 2, 2021

@dj110919871: do you mean it's fixed for you?

Generally, do we still want to support pre-1.24 Custom setups? If not, could we close this?

@emilypi emilypi removed the meta: hvr label Aug 11, 2021
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

9 participants