Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to print GHC output to stdout #3225

Closed
nh2 opened this issue Jun 20, 2017 · 7 comments
Closed

Add flag to print GHC output to stdout #3225

nh2 opened this issue Jun 20, 2017 · 7 comments
Milestone

Comments

@nh2
Copy link
Collaborator

@nh2 nh2 commented Jun 20, 2017

Having streaming compilation output is super useful to ensure that things compile at the right speed, especially when piping into something like ts.

#426 added a flag that can stream to a file, but that still doesn't provide streaming terminal output.

Of course interleaved output makes things messy, so it would make sense for this flag to work only for -j1.

Note that (quote @mgsloan)

If it's a local package and the last thing to build with -j1, it should output the log

but it would be great to have it also for snapshot packages.

@recursion-ninja
Copy link

@recursion-ninja recursion-ninja commented Aug 7, 2017

Our project recently moved to a multi-package build setup, and we immediately encountered this defect. I see that this is currently a low-priority issue, but I'd argue that it's actually high-priority, as it's an essential function of a build system.

Every other build system or compiler I've used does it by default, e.g. gcc, clang, Java, the Python and Perl interpreters, and of course both GHC and cabal. But rather than just appealing to authority, here's a concrete example of why it's important. Recently one of our test suites regressed from running in about a minute to taking an hour. I had no idea why stack had hung. It could have been (off the top of my head) any permutation of:

  • The compiler running into an undecidable instance.
  • A test suite gone awry.
  • A benchmark executing an infinite loop.

Without output streaming to the terminal this is next to impossible to diagnose.

And then, of course, sometimes you need to see a warning to determine the cause of an error that appears later in the build process, but that's not possible under either of these scenarios.

I've read through all of the threads regarding this subject, just a few of which are:

I don't find any of the suggested workaround satisfactory, but I'd like to take special exception to the suggestion that I build with --pedantic, which is all but worthless. Aside from that fact that erroring out is for errors and not for warnings, it means that the compiler stops even for warnings that it over zealously complains about, such as type family deductions and over-determined constraints.

Is it possible to stream to the terminal in multi-package builds the output from GHC compilation, test suites, benchmarks, etc just like what occurs in a single package build, regardless of whether the packages are being built in parallel or not. While I think this should be the default and users should need to opt-out of this information, I'd settle for an opt-in flag for streaming the output of my packages building to the terminal.

Loading

@mgsloan
Copy link
Contributor

@mgsloan mgsloan commented Aug 7, 2017

Is it possible to stream to the terminal in multi-package builds the output from GHC compilation, test suites, benchmarks, etc just like what occurs in a single package build, regardless of whether the packages are being built in parallel or not.

PRs appreciated! This is quite a lot trickier than it would seem.

Loading

@recursion-ninja
Copy link

@recursion-ninja recursion-ninja commented May 10, 2018

@mgsloan The onus is not on me, the user of stack, to implement essential functionality of stack as a build system.

Can a collaborator reopen this issue and add it to a milestone, preferably P1: Must.

Loading

@mgsloan mgsloan added this to the P2: Should milestone May 24, 2018
@mgsloan
Copy link
Contributor

@mgsloan mgsloan commented May 24, 2018

@recursion-ninja This issue is not closed, and I've added it to the P2 milestone because things work fine without this nicety. Note that logs do get streamed into .stack-work/logs, so you can look at those if you need to know what's going on.

It is unclear how this streaming output should behave. In the presence of concurrent builds, which one gets streamed to the output? Perhaps the output should get interspersed with some indication of which process it comes from? Not saying there aren't good answers to this, but in addition to implementation there is the problem of determining what should be implemented.

The onus is not on me, the user of stack, to implement essential functionality of stack as a build system.

Stack is an opensource project.

Loading

@nh2
Copy link
Collaborator Author

@nh2 nh2 commented May 24, 2018

Perhaps the output should get interspersed with some indication of which process it comes from?

@mgsloan The way nixops does it works quite well and looks like this:

server1> Stopping service nginx
server2> Stopping service nginx
server1> Starting service apache
server3> Stopping service nginx
server2> Starting service apache
server3> Starting service apache

where the server3> bits have some nice different terminal colours so you can easily distinguish what belongs to what visually (and the colours make it strangely satisfying to look at).

This approach still gives a very good indication of progress, and is copy-paste friendly.

And, even more conveniently, you can sort the output by the prefix up to > to recover each process's individual output in one block.

Loading

@mgsloan
Copy link
Contributor

@mgsloan mgsloan commented May 25, 2018

Yeah, that sounds good to me @nh2 . Ok, so we've decided on the goal behavior, so that part is done :)

Loading

@snoyberg
Copy link
Contributor

@snoyberg snoyberg commented Jun 19, 2018

Relevant PR: #4097

Loading

snoyberg added a commit that referenced this issue Jun 19, 2018
snoyberg added a commit that referenced this issue Jun 21, 2018
Add the interleaved-output option/config value #3225
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants