cabal icon indicating copy to clipboard operation
cabal copied to clipboard

`Q:` how does `cabal build` choose/ find the package nodes

Open MangoIV opened this issue 3 years ago • 5 comments

I was wondering what exactly cabal looks at to decide which packages to include when trying to build a packages dependencies. (In particular I'm trying to find out what configuration could cabal cause to not include a sublib into a build although its *.conf file and the actual package is provided to the environment)

MangoIV avatar Sep 18 '22 13:09 MangoIV

Hi, thanks for posting the question, maybe @fgaz or @grayjay could help us here with some insights Related: https://github.com/haskell/cabal/issues/6039

jneira avatar Sep 18 '22 19:09 jneira

Thank you very much, as you suggested, I will also include my reproducer, in this case, of course, only the cabal files are interesting.

MangoIV avatar Sep 18 '22 19:09 MangoIV

One thing to note is that from an outside perspective, the respective package-db that you would get when including bla:bla-bla with a cabal.project vs including it via haskell.nix look basically the same. (Maybe I'm missing something though)

MangoIV avatar Sep 18 '22 19:09 MangoIV

You need to provide more details with the reproducer. What is the command given, the actual, and the expected behavior?

gbaz avatar Sep 21 '22 14:09 gbaz

Hi @gbaz, in the reproducer, the haskell.nix code makes the dependencies available in the shell. If I try to cabal build in the blup dir, cabal tells me, that bla doesn't contain sublib blabla, although it does. It does pick up the package db, so that doesn't seem to be the reason. I basically want to know how cabal figures out what components a library (int this case bla) contains so I can trouble shoot that step by step. The reason for that is that I don't see how it corresponds to e.g. ghc-pkg and I don't see the difference in the package-dbs.

MangoIV avatar Sep 22 '22 12:09 MangoIV

@MangoIV: I'm afraid, the question you ask very few living persons know the answer to or are able to code-dive and fish out. If you'd live to code-dive on your own, however, and diary the attempt here, I hope we'd be able to help and we'd all learn from the experience.

Mikolaj avatar Oct 29 '22 19:10 Mikolaj

@MangoIV I'm pretty sure this is https://github.com/haskell/cabal/issues/6039#issuecomment-633771330 (see #5660 for the general status of multiple public libraries). You can confirm by trying to build with bare Cabal, that should work.

fgaz avatar Mar 20 '23 19:03 fgaz