Skip to content

Pre-release and multi-repl incompatible with Custom setup #9632

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
TeofilC opened this issue Jan 19, 2024 · 7 comments
Closed

Pre-release and multi-repl incompatible with Custom setup #9632

TeofilC opened this issue Jan 19, 2024 · 7 comments

Comments

@TeofilC
Copy link
Collaborator

TeofilC commented Jan 19, 2024

Describe the bug
Cabal's multi-repl support requires a version of the Cabal library >=3.11.
This is fine when using cabal-install's builtin copy of the Cabal library.
But when packages' Custom setups require Cabal as build dependency, we run into problems as this version is not yet released, so not available on Hackage, and it's not the version bundled with the user's GHC.

To Reproduce
Try using a pre-release cabal to run

cabal repl --enable-multi-repl --allow-newer postgresql-libpq
Output
Warning: this is a debug build of cabal-install with assertions enabled.
Resolving dependencies...
Error: [Cabal-7107]
Could not resolve dependencies:
...
[__1] trying: postgresql-libpq-0.10.0.0 (dependency of eventstore)
[__2] next goal: postgresql-libpq:setup.Cabal (dependency of postgresql-libpq)
[__2] rejecting: postgresql-libpq:setup.Cabal-3.10.2.0/installed-inplace, postgresql-libpq:setup.Cabal-3.10.2.1, postgresql-libpq:setup.Cabal-3.10.2.0, postgresql-libpq:setup.Cabal-3.10.1.0, postgresql-libpq:setup.Cabal-3.8.1.0, postgresql-libpq:setup.Cabal-3.6.3.0, postgresql-libpq:setup.Cabal-3.6.2.0, postgresql-libpq:setup.Cabal-3.6.1.0, postgresql-libpq:setup.Cabal-3.6.0.0, postgresql-libpq:setup.Cabal-3.4.1.0, postgresql-libpq:setup.Cabal-3.4.0.0, postgresql-libpq:setup.Cabal-3.2.1.0, postgresql-libpq:setup.Cabal-3.2.0.0, postgresql-libpq:setup.Cabal-3.0.2.0, postgresql-libpq:setup.Cabal-3.0.1.0, postgresql-libpq:setup.Cabal-3.0.0.0, postgresql-libpq:setup.Cabal-2.4.1.0, postgresql-libpq:setup.Cabal-2.4.0.1, postgresql-libpq:setup.Cabal-2.4.0.0, postgresql-libpq:setup.Cabal-2.2.0.1, postgresql-libpq:setup.Cabal-2.2.0.0, postgresql-libpq:setup.Cabal-2.0.1.1, postgresql-libpq:setup.Cabal-2.0.1.0, postgresql-libpq:setup.Cabal-2.0.0.2, postgresql-libpq:setup.Cabal-1.24.2.0, postgresql-libpq:setup.Cabal-1.24.0.0, postgresql-libpq:setup.Cabal-1.22.8.0, postgresql-libpq:setup.Cabal-1.22.7.0, postgresql-libpq:setup.Cabal-1.22.6.0, postgresql-libpq:setup.Cabal-1.22.5.0, postgresql-libpq:setup.Cabal-1.22.4.0, postgresql-libpq:setup.Cabal-1.22.3.0, postgresql-libpq:setup.Cabal-1.22.2.0, postgresql-libpq:setup.Cabal-1.22.1.1, postgresql-libpq:setup.Cabal-1.22.1.0, postgresql-libpq:setup.Cabal-1.22.0.0, postgresql-libpq:setup.Cabal-1.20.0.4, postgresql-libpq:setup.Cabal-1.20.0.3, postgresql-libpq:setup.Cabal-1.20.0.2, postgresql-libpq:setup.Cabal-1.20.0.1, postgresql-libpq:setup.Cabal-1.20.0.0, postgresql-libpq:setup.Cabal-1.18.1.7, postgresql-libpq:setup.Cabal-1.18.1.6, postgresql-libpq:setup.Cabal-1.18.1.5, postgresql-libpq:setup.Cabal-1.18.1.4, postgresql-libpq:setup.Cabal-1.18.1.3, postgresql-libpq:setup.Cabal-1.18.1.2, postgresql-libpq:setup.Cabal-1.18.1.1, postgresql-libpq:setup.Cabal-1.18.1, postgresql-libpq:setup.Cabal-1.18.0, postgresql-libpq:setup.Cabal-1.16.0.3, postgresql-libpq:setup.Cabal-1.16.0.2, postgresql-libpq:setup.Cabal-1.16.0.1, postgresql-libpq:setup.Cabal-1.16.0, postgresql-libpq:setup.Cabal-1.14.0, postgresql-libpq:setup.Cabal-1.12.0, postgresql-libpq:setup.Cabal-1.10.2.0, postgresql-libpq:setup.Cabal-1.10.1.0, postgresql-libpq:setup.Cabal-1.10.0.0, postgresql-libpq:setup.Cabal-1.8.0.6, postgresql-libpq:setup.Cabal-1.8.0.4, postgresql-libpq:setup.Cabal-1.8.0.2, postgresql-libpq:setup.Cabal-1.6.0.3, postgresql-libpq:setup.Cabal-1.6.0.2, postgresql-libpq:setup.Cabal-1.6.0.1, postgresql-libpq:setup.Cabal-1.4.0.2, postgresql-libpq:setup.Cabal-1.4.0.1, postgresql-libpq:setup.Cabal-1.4.0.0, postgresql-libpq:setup.Cabal-1.2.4.0, postgresql-libpq:setup.Cabal-1.2.3.0, postgresql-libpq:setup.Cabal-1.2.2.0, postgresql-libpq:setup.Cabal-1.2.1, postgresql-libpq:setup.Cabal-1.1.6, postgresql-libpq:setup.Cabal-1.24.1.0 (constraint from --enable-multi-repl requires >=3.11)
[__2] fail (backjumping, conflict set: postgresql-libpq, postgresql-libpq:setup.Cabal)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: postgresql-libpq:setup.Cabal, eventstore, postgresql-libpq

Expected behavior
This should work fine

Workaround

We can work around this issue by adding Cabal and Cabal-syntax to our cabal.project using a source-repository-package, eg:

source-repository-package
    type: git
    location: https://github.com/haskell/cabal.git
    subdir: Cabal

source-repository-package
    type: git
    location: https://github.com/haskell/cabal.git
    subdir: Cabal-syntax
@fgaz
Copy link
Member

fgaz commented Jan 19, 2024

This is expected. The multi-repl functionality needs Cabal>=3.11, and cabal-install can't conjure it from nothing.

What do you suggest should happen?

@TeofilC
Copy link
Collaborator Author

TeofilC commented Jan 19, 2024

I think maybe the best we can do is document the workaround somewhere.

I guess if it was possible it would be good to be able to bundle the Cabal and Cabal-syntax libraries with cabal-install for pre-releases, but I don't think that's doable (or at least not easily)

@Bodigrim
Copy link
Collaborator

@TeofilC thanks for figuring out the workaround! I hit the same issue recently.

@mpickering
Copy link
Collaborator

See #9741 for an idea about how to tackle this.

@andreabedini
Copy link
Collaborator

Definitely this should be documented somewhere but TBH it is not an issue that has to be fixed. As @fgaz says, Cabal 3.11 hasn't been released yet and source-repository-package is the way to get a package from github.

@TeofilC
Copy link
Collaborator Author

TeofilC commented Feb 27, 2024

I forgot to link to it here, but I've already added some documentation of this to the README in the static pre-releases patch:

cabal/README.md

Lines 50 to 61 in 9025af5

You might need to add the following to your `cabal.project` file
if your build fails because of an out-of-date `Cabal` library:
```
allow-newer:
*:Cabal,
*:Cabal-syntax
source-repository-package
type: git
location: https://github.com/haskell/cabal.git
subdir: Cabal Cabal-syntax
```

@fendor
Copy link
Collaborator

fendor commented Dec 9, 2024

Closing, as this isn't relevant any more to the latest pre-release, afaict.
Since then, this issue has been resolved, imo. Feel free to reopen if I missed something :)

@fendor fendor closed this as completed Dec 9, 2024
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

6 participants