I am using cabal v2-build
to build a project and it keeps failing on a package that I do not directly depend on. Is there a way with cabal
to list all of a package's dependencies (ideally in tree format) so I can see what I'm relying on that's calling the build fail and (hopefully) get rid of it.
Try cabal-plan
: https://hackage.haskell.org/package/cabal-plan
In particular cabal-plan info
will display copious information on dependencies in a tree format.
Note that cabal-plan
requires that you've run cabal
first, but the build need not complete successfully. It just needs to get past the build-plan stage. cabal-plan
will then read the meta-info cabal created and display it in a readable format for you in detail.
(Aside: cabal-plan
can also create transitive license info, quite useful as well. See the license-report
option, which does require a separate flag during build time.)
cabal-plan
does not seem to work for transitive dependencies.
You can use cabal freeze
and look at the generated freeze file to see every single dependency that is required for the project.
(also, here's a useful tool for looking up reverse dependencies https://packdeps.haskellers.com/reverse)
cabal freeze
writes out a freeze file which records all of the versions and flags that are picked by the solver under the current index and flags. Default name of this file iscabal.project.freeze
… …
https://cabal.readthedocs.io/en/3.8/cabal-commands.html#cabal-freeze
© 2022 - 2024 — McMap. All rights reserved.
cabal-plan
only needs that thecabal configure
step executed successfully, creating the meta-info in thedist-newstyle
directory. – Psychoneurosis