How to dial down verbosity in rust compiler build?

Hi, I noticed that the handling of verbosity has been changed recently (between 1.68.2 and 1.69.0), and my local patch to dial down the verbosity of the rust compiler build no longer applies.

It is therefore perhaps time to ask about the proper way to do this.

I see after configuration, config.toml contains a commented-out #verbose=0 setting, leading me to think that this was perhaps the default. That does not appear to be the case, or at least it does not govern how cargo is invoked. In my build log I still see cargo being invoked with the --verbose flag, and I suspect that is what's causing it to output the various "Running ..." lines in the build log.

It also appears that the python configure script doesn't support --verbosity=0.

So ... is there a proper supported way to dial down the verbosity of the build log of the rust compiler?

Does the term.quiet configuration setting work for you? It will remove every log message, so not sure whether you want that or not. You can provide it as an argument as well, i.e. cargo build --quiet or with the CARGO_TERM_QUIET environment variable, like CARGO_TERM_QUIET=true cargo build, for example.


That is indeed only displayed when Cargo is executed with term.verbose = true. Can you change the configure script to run Cargo without that flag? As I understand the documentation, --verbose overrides the term.quiet setting.

I had in mind a change which might change the majority of the rust-based build log to look like this:

   Compiling libc v0.2.137
   Compiling memchr v2.5.0
   Compiling cfg-if v1.0.0
   Compiling version_check v0.9.4
   Compiling typenum v1.15.0
   Compiling cc v1.0.73

and omit stuff like

     Running `/usr/pkgsrc/wip/rust/work/rust-bootstrap/bin/rustc --crate-name build_script_build /usr/pkgsrc/wip/rust/work/rustc-1.69.0-src/vendor/libc-0.2.137/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=0 --cfg 'feature="default"' --cfg 'feature="extra_traits"' --cfg 'feature="std"' -C metadata=9e8e188d361dc46c -C extra-filename=-9e8e188d361dc46c --out-dir /usr/pkgsrc/wip/rust/work/rustc-1.69.0-src/build/bootstrap/debug/build/libc-9e8e188d361dc46c -L dependency=/usr/pkgsrc/wip/rust/work/rustc-1.69.0-src/build/bootstrap/debug/deps --cap-lints allow -Wrust_2018_idioms -Wunused_lifetimes -Dwarnings`

I'll test your suggestion a little later, but have a vague suspcion it'll dial the verbosity all the way down, i.e. I would not get any output from cargo as long as it builds OK?

The other issue is "is there an argument I can supply to src/bootstrap/configure.py to cause term.quiet to be set? And that's supposed to go in config.toml?

Ohh, you are talking about rustbuild. I'm not very familiar with x.py honestly. Maybe this section from the rustc-dev-guide will help you? Like passing CARGOFLAGS_BOOTSTRAP="--quiet", maybe? I actually can't reproduce the verbose output by running ./x.py build. Can you tell us what command you are running that causes the verbose output?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.