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

Cargo prints "Compiling <crate>" when build script runs, and gives no indication when the final crate artefact is being built #833

Closed
huonw opened this issue Nov 11, 2014 · 4 comments
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. A-diagnostics Area: Error and warning messages generated by Cargo itself. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.

Comments

@huonw
Copy link
Member

huonw commented Nov 11, 2014

[package]

name = "a"
version = "0.0.1"
authors = []
build = "build.rs"

[dependencies.compile_msg]
git = "https://github.com/huonw/compile_msg"
// build.rs
fn main() {}
// src/main.rs
fn main() { println!("hi") }
$ cargo clean && cargo build
   Compiling a v0.0.1 (file:///home/huon/projects/test-rust/tmp/a)
   Compiling compile_msg v0.1.0 (https://github.com/huonw/compile_msg#569c6f18)
$ ./target/a # it worked!
hi

Without the build = ... line the output of cargo build is

   Compiling compile_msg v0.1.0 (https://github.com/huonw/compile_msg#569c6f18)
   Compiling a v0.0.1 (file:///home/huon/projects/test-rust/tmp/a)

I was expecting something like

   Compiling build command a v0.0.1 (file:///home/huon/projects/test-rust/tmp/a)
   Compiling compile_msg v0.1.0 (https://github.com/huonw/compile_msg#569c6f18)
   Compiling a v0.0.1 (file:///home/huon/projects/test-rust/tmp/a)

(Possibly renaming the first line to Executing build command ... or even having a separate line for when it is executed.)

@alexcrichton
Copy link
Member

There's definitely a balance here in not wanting to inundate users with overwhelming amounts of log output while also providing a meaningful set of output. The current rationale is basically to print precisely one message per package, and that message is printed when the first nontrivial step is run.

cc @wycats, you've had opinions on this before.

@reem
Copy link

reem commented Nov 24, 2014

I also found this behavior unintuitive and expected something like Compiling build command

@alexcrichton alexcrichton added the A-diagnostics Area: Error and warning messages generated by Cargo itself. label Jan 14, 2015
@mrhota
Copy link

mrhota commented May 30, 2016

Unintuitive. The documentation doesn't seem to mention the fact that any output of build commands is printed into a file in target/debug/build//output and cargo gives zero indication that the build script has been 1) compiled or 2) executed.

@carols10cents carols10cents added A-console-output Area: Terminal output, colors, progress bar, etc. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` labels Sep 29, 2017
@epage epage added the S-triage Status: This issue is waiting on initial triage. label May 3, 2023
@weihanglo
Copy link
Member

Triage: Not sure if this 8-year-old issue is still relevant. Today you can use cargo build --verbose to look the exact commands Cargo runs. It shows first compiling the build script and second running the build-script-build executable. Cargo is already verbose hence we don't want more messages coming out.

It is also unclear to me why people want to know if a build script is compiling. If that is in regard to inspecting build failures, #11636 improved it a bit in 1.70.0.

In terms of progress message enhancement, we are looking forward to an overhaul of the entire progress ouptut in Cargo. #8889 is the main tracking issue for that. Going to close this. If you have opinions, please comment here or in #8889.

@weihanglo weihanglo closed this as not planned Won't fix, can't repro, duplicate, stale Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. A-diagnostics Area: Error and warning messages generated by Cargo itself. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

7 participants