You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cabal install buries compiler warnings in logs, making them less obvious #1062
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.
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:
# 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.
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.
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.
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).
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.)
(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 :))
Activity
tibbe commentedon Oct 9, 2012
I think these are all good ideas. The major roadblock is that we just call
Setup.hsto 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 theSimplebuild 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:
I think we could do something similar
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.
23Skidoo commentedon Oct 18, 2012
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 eachprintBuildResultcall.accursoft commentedon Nov 16, 2014
Could
cabal installwith a single target behave likecabal 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.
BardurArantsson commentedon Jun 19, 2015
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).
BardurArantsson commentedon Jun 24, 2015
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.)
BardurArantsson commentedon Jun 24, 2015
(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 :))
ulysses4ever commentedon Jun 11, 2022
v1 is deprecated. Should this be closed?
Mikolaj commentedon Jun 11, 2022
Yes, I'm afraid we won't be able to work on that and v2- has even greater problems in this area. :) Closing.