Skip to content

cabal new-build doesn't produce logs for local packages #5901

Open

Description

@bgamari

As far as I can tell cabal new-build no longer produces log files for local package builds. For instance,

$ git clone https://github.com/haskell-hvr/cabal-plan
$ cd cabal-plan
$ cabal new-build all
$ find -iname '*.log' | wc -l 
0

Moreover, -v2 shows no indication that a log was generated. I have a vague sense that this used to work so I suspect there is a regression here.

Activity

  1. added this to the 3.9 milestone on Jun 11, 2022
  2. ulysses4ever commented on Jun 12, 2022

    @ulysses4ever
    Collaborator

    Was cabal new-build supposed to generate a log with no explicit request for it? I tried versions back to 2.0 and didn't see it producing any logs on its own, so I'm curious what kind lf logs @bgamari meant and which verision of cabal-install produced those.

    If anything, I'd expect v2-build to produce logs if the --build-log flag is triggered. Alas, the same experiment (cabal-install 3 as well as 2) don't produce anything even with the flag. This sounds like a bug as mentioned in #6811. I'm not sure if this is the same bug (and one of these issues should be closed as a dup) or not.

    Grepping for --build-log returns a curious result:

    , option [] ["build-log"]
    "Log all builds to file (name template can use $pkgid, $compiler, $os, $arch)"
    installLogFile (\v flags -> flags { installLogFile = v })

    So, the CLI flag triggers an InstallFlag called installLogFile. It was commited 14 years back here: 5702472 and was supposed for cabal install. And today it's essentially used only in Distribution/Client/Install.hs. No wonder, it has no impact on v2-build.

    Arguably, the bug here is that --build-log is shown in cabal v2-build --help: it probably shouldn't (with the current design). Having logs for v2-build would be a feature request.

  3. mouse07410 commented on Sep 9, 2022

    @mouse07410
    Collaborator

    Could you tell me what are my options for getting verbose build log from Cabal (building local packages)?

  4. ulysses4ever commented on Sep 9, 2022

    @ulysses4ever
    Collaborator

    @mouse07410 the only workaround I’m aware about is to redirect cabal build’s stdout (and maybe stderr) to a file. Let me know if this is not good enough. This bug (or rather omission in v2) is rather unfortunate, I agree. We’d love to have someone fix it and happy to advise.

  5. mouse07410 commented on Sep 15, 2022

    @mouse07410
    Collaborator

    Well, it's not a beautiful workaround - but it works.

  6. andreabedini commented on Jul 11, 2023

    @andreabedini
    Collaborator

    This should be easy to fix. All the changes should be contained in buildInplaceUnpackedPackage (to be compared with buildAndInstallUnpackedPackage). One decision to be made would be where to to store them; if we don't already have a good spot in distDirLayout I think we can make a new one?

  7. ulysses4ever commented on Jul 11, 2023

    @ulysses4ever
    Collaborator

    Some good related work is here, I think:

    @gbaz revived --build-summary for v2 but suggested to remove --build-log altogether. This felt a bit extreme to me tbh.

  8. andreabedini commented on Jul 11, 2023

    @andreabedini
    Collaborator

    Thanks @ulysses4ever I was going to suggest we close this and #6811 as duplicates of #8456 but I had missed the ticket you mention.

    ninja edit: I am tempted to suggest we could simply log all local package builds in the dist folder (even by default) but I cannot have a clear picture until we collect all these tickets into a single one.

    ninja edit 2: #7567 is mostly around build reports and only incidentally mentions build-log. I agree we should not remove it altogether.

  9. alt-romes commented on Feb 9, 2024

    @alt-romes
    Collaborator

    FWIW, after #9524, this can be very easily seen in

    Nothing -- no log file for inplace builds!

    We /never/ use a log file for building inplace packages, so regardless of the default log file or specified via cli flags, we will write the output of an inplace build to the stdout (see setup in the same file, which calls withLogging).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions