Skip to content

cabal install buries compiler warnings in logs, making them less obvious #1062

Closed

Description

@joeyadams

When you cabal install a package or set of packages, it generates per-package build logs and puts them in ~/.cabal/logs. It no longer prints these build messages directly. I guess this is needed for parallel build support.

This is neat, but has a terrible side effect: compiler warnings are no longer obvious, except in one's own individual package built with cabal build. This means:

  • Most users won't see compiler warnings in upstream packages, meaning they're less likely to get reported and fixed.
  • Building a collection of local packages (e.g. cabal install ./Cabal ./cabal-install) buries compiler warnings in log files, making them less obvious.

Another side effect is that it hides progress. Some modules take inordinately long to build (e.g. Crypto.CPoly in crypto-api). It'd be nice to see which ones those are.

I don't know the best way to solve this, but here are some ideas:

  • Print the path to the log file. Instead of:

    Building cereal-0.3.5.2...
    

    Say:

    Building cereal-0.3.5.2 ( /home/joey/.cabal/logs/cereal-0.3.5.2.log )
    
  • Summarize build results in output:

    Installed cereal-0.3.5.2 (3 warnings)
    

    or perhaps:

    Installed cereal-0.3.5.2 (3 warnings; see /home/joey/.cabal/logs/cereal-0.3.5.2.log )
    
  • Forward any compiler errors and warnings to output, at least by default.

  • When -j1 is used, and when the output medium supports it: print the name of the module currently being built, and modify it in-place (e.g. "\rBuilding Crypto.CPoly\e[K"). This would look pretty slick.

Activity

  1. tibbe commented on Oct 9, 2012

    @tibbe
    Contributor

    I think these are all good ideas. The major roadblock is that we just call Setup.hs to do the build. We do this to allow for users to use custom build systems, but it makes it more difficult to understand the output of the build system. I think we should specialize for the case of the Simple build system, where we have a better idea of what's going on (i.e. we're calling GHC ourselves). Perhaps it could be as easy as just piping the stderr output of GHC (assuming that warning go there instead of stdout) through a serializing writer (e.g. it writes each line atomically).

    I like the output (including in-place updates) of Gentoo's parallel builds:

    # emerge -uD system -j --load-average=4.5
    Calculating dependencies... done!
    >>> Verifying ebuild manifests
    >>> Starting parallel fetch
    >>> Emerging (1 of 14) dev-libs/expat-2.0.1-r1
    >>> Emerging (2 of 14) sys-devel/autoconf-wrapper-6
    >>> Emerging (3 of 14) sys-kernel/linux-headers-2.6.27-r2
    >>> Installing sys-devel/autoconf-wrapper-6
    >>> Jobs: 0 of 14 complete, 3 running  Load avg: 2.99, 1.59, 0.67
    

    I think we could do something similar

    # cabal install -j yesod
    Building (1 of 14) attoparsec-1.2.3.4...
    Building (2 of 14) text-1.10.2.4...
    Building (3 of 14) aeson-3.2.1.4...
    Foo.hs:1:1: Warning: Unused constraint: Ord a
    Installed attoparsec-1.2.3.4
    Building (4 of 14) binary-1.2.1.4...
    Jobs: 1 of 14 complete, 3 running  Load avg: 2.92, 1.69, 0.68
    

    I put a warning in the above example to show what it might look like. We might need to prefix the message with some indicator of which package generated the warning.

  2. 23Skidoo commented on Oct 18, 2012

    @23Skidoo
    Member

    Summarize build results in output:
    Installed cereal-0.3.5.2 (3 warnings)
    or perhaps:
    Installed cereal-0.3.5.2 (3 warnings; see /home/joey/.cabal/logs/cereal-0.3.5.2.log )

    This one should be relatively easy to implement: in printBuildResult, just parse the log file and count warnings. If we find out that doing that in the control thread slows down the build, we can go back to the scheme with a separate output thread and fork a new thread for each printBuildResult call.

  3. accursoft commented on Nov 16, 2014

    @accursoft

    Could cabal install with a single target behave like cabal install --only-dependencies && cabal build?

    This wouldn't solve every case, but may satisfy the 80% who are installing a single package, and are only really interested in the warnings generated by the immediate target.

  4. modified the milestones: , cabal-install-1.22 on Apr 23, 2015
  5. BardurArantsson commented on Jun 19, 2015

    @BardurArantsson
    Collaborator

    I may be off my rocker here, but couldn't this be solved rather easily by just (atomically) copying the whole log file to stdout post-build (of each package)? Possibly via an option to "cabal install"? True, you won't get fancy "summary" information, but at least you get information that you can actually use for something and which doesn't require manually looking up log files.

    It would definitely solve the case that I'm personally interested in, namely seeing warnings for a set of co-dependent packages that I'm developing where I use "cabal install dir1 dir2 dir3 ..." to build all of them together (with a coherent set of dependencies).

  6. BardurArantsson commented on Jun 24, 2015

    @BardurArantsson
    Collaborator

    Alright, so as far as I can tell just printing the logs post-each-job should be quite a simple modification to printBuildResult in Install.hs in cabal-install. As this is an 80% solution that works for me, I'll try to make that work and submit a PR.

    AFAICT there's no parallelism involved here, and so it should be fine without any explicit locking anywhere.

    Any comments, questions, doubts, etc.?

    Btw, should this be behind an option? (I would prefer not having it behind "verbosity" since that could potentially induce all manner of ther output.)

  7. BardurArantsson commented on Jun 24, 2015

    @BardurArantsson
    Collaborator

    (Oh, yes. Personally, I wouldn't want this behind an option since it just harmonizes what happens with -j1 vs. -jN, but if that's a requirement for getting it in, I'm happy to add it :))

  8. modified the milestones: cabal-install 1.24, on Feb 21, 2016
  9. modified the milestone: cabal-install 2.0 on Sep 6, 2016
  10. removed their assignment
    on Sep 13, 2016
  11. ulysses4ever commented on Jun 11, 2022

    @ulysses4ever
    Collaborator

    v1 is deprecated. Should this be closed?

  12. Mikolaj commented on Jun 11, 2022

    @Mikolaj
    Member

    Yes, I'm afraid we won't be able to work on that and v2- has even greater problems in this area. :) Closing.

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions