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

Printing to stdout/stderr no longer works during rustc bootstrap #43855

Closed
petrochenkov opened this issue Aug 13, 2017 · 4 comments
Closed

Printing to stdout/stderr no longer works during rustc bootstrap #43855

petrochenkov opened this issue Aug 13, 2017 · 4 comments
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.

Comments

@petrochenkov
Copy link
Contributor

petrochenkov commented Aug 13, 2017

Any attempt to do "printf debugging" with println, or bootstrapping with -Z time-passes, or outputting any other useful information to stdout from rustc results in "failed to parse process output" reported from Cargo (https://github.com/rust-lang/cargo/blob/668d55cc6d54c7e9635c924c252621f5e6664e00/src/cargo/util/process_builder.rs#L205).

This is a regressions from the recent few months, I believe.
Printf debugging can be emulated with hacks like sess.span_warn() or similar, or by recompiling everything and using debug!(...), but I haven't found a workaround for time-passes yet.

Writing to stderr (e.g. eprintln) doesn't work as well, the output is silently ignored for some reason, but I haven't investigated why this happens. (UPDATE: The stderr issue was fixed in #47634)

Any workarounds are appreciated.

cc someone familiar with Cargo and infrastructure @Mark-Simulacrum @alexcrichton

@petrochenkov petrochenkov added T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Aug 13, 2017
@alexcrichton
Copy link
Member

I believe this is because we switched to calling Cargo with --message-format json but we force the compiler through "hacks" to not actually emit json but continue to emit data on stderr. In this mode Cargo asserts stdout is empty and forwards stderr but tries to parse JSON.

That seems definitely fixable in Cargo (just forwarding stdout from the compiler) but I'm not entirely sure why printing to stderr wouldn't work, in theory it should get forwarded all the way out. In rustbuild we don't even try to capture stderr...

@carols10cents carols10cents added the C-bug Category: This is a bug. label Aug 14, 2017
@petrochenkov petrochenkov changed the title Printing to stdout no longer works during rustc bootstrap Printing to stdout/stderr no longer works during rustc bootstrap Sep 1, 2017
@Mark-Simulacrum Mark-Simulacrum added this to the impl period milestone Sep 15, 2017
@aturon aturon removed this from the impl period milestone Sep 15, 2017
@devurandom
Copy link
Contributor

This might be somewhat fixed by #47634 and is probably duplicated by #44244

@wesleywiser
Copy link
Member

Just ran into this myself. eprintln!() instead of println!() does work though.

@petrochenkov
Copy link
Contributor Author

Not sure about println, but eprintln works now and that's enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants