Skip to content

-vvv annoyances #1561

@dot-asm

Description

@dot-asm

I think everybody would appreciate even verbose output to be on point. Here is typical output

[bar 0.1.0] OPT_LEVEL = Some(0)
[bar 0.1.0] TARGET = Some(x86_64-unknown-linux-gnu)
[bar 0.1.0] HOST = Some(x86_64-unknown-linux-gnu)
[bar 0.1.0] cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
[bar 0.1.0] CC_x86_64-unknown-linux-gnu = None
[bar 0.1.0] cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
[bar 0.1.0] CC_x86_64_unknown_linux_gnu = None
[bar 0.1.0] cargo:rerun-if-env-changed=HOST_CC
[bar 0.1.0] HOST_CC = None
[bar 0.1.0] cargo:rerun-if-env-changed=CC
[bar 0.1.0] CC = None
[bar 0.1.0] cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
[bar 0.1.0] RUSTC_WRAPPER = None
[bar 0.1.0] cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
[bar 0.1.0] CRATE_CC_NO_DEFAULTS = None
[bar 0.1.0] DEBUG = Some(true)
[bar 0.1.0] CARGO_CFG_TARGET_FEATURE = Some(fxsr,sse,sse2)
[bar 0.1.0] cargo:rerun-if-env-changed=CFLAGS
[bar 0.1.0] CFLAGS = None
[bar 0.1.0] cargo:rerun-if-env-changed=HOST_CFLAGS
[bar 0.1.0] HOST_CFLAGS = None
[bar 0.1.0] cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
[bar 0.1.0] CFLAGS_x86_64_unknown_linux_gnu = None
[bar 0.1.0] cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
[bar 0.1.0] CFLAGS_x86_64-unknown-linux-gnu = None
[bar 0.1.0] CARGO_ENCODED_RUSTFLAGS = Some()
[bar 0.1.0] OUT_DIR = Some(/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out)
[bar 0.1.0] cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
[bar 0.1.0] cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
[bar 0.1.0] CRATE_CC_NO_DEFAULTS = None
[bar 0.1.0] TARGET = Some(x86_64-unknown-linux-gnu)
[bar 0.1.0] CARGO_CFG_TARGET_FEATURE = Some(fxsr,sse,sse2)
[bar 0.1.0] HOST = Some(x86_64-unknown-linux-gnu)
[bar 0.1.0] cargo:rerun-if-env-changed=CFLAGS
[bar 0.1.0] CFLAGS = None
[bar 0.1.0] cargo:rerun-if-env-changed=HOST_CFLAGS
[bar 0.1.0] HOST_CFLAGS = None
[bar 0.1.0] cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
[bar 0.1.0] CFLAGS_x86_64_unknown_linux_gnu = None
[bar 0.1.0] cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
[bar 0.1.0] CFLAGS_x86_64-unknown-linux-gnu = None
[bar 0.1.0] cargo:rerun-if-env-changed=AR_x86_64-unknown-linux-gnu
[bar 0.1.0] AR_x86_64-unknown-linux-gnu = None
[bar 0.1.0] cargo:rerun-if-env-changed=AR_x86_64_unknown_linux_gnu
[bar 0.1.0] AR_x86_64_unknown_linux_gnu = None
[bar 0.1.0] cargo:rerun-if-env-changed=HOST_AR
[bar 0.1.0] HOST_AR = None
[bar 0.1.0] cargo:rerun-if-env-changed=AR
[bar 0.1.0] AR = None
[bar 0.1.0] cargo:rerun-if-env-changed=ARFLAGS
[bar 0.1.0] ARFLAGS = None
[bar 0.1.0] cargo:rerun-if-env-changed=HOST_ARFLAGS
[bar 0.1.0] HOST_ARFLAGS = None
[bar 0.1.0] cargo:rerun-if-env-changed=ARFLAGS_x86_64_unknown_linux_gnu
[bar 0.1.0] ARFLAGS_x86_64_unknown_linux_gnu = None
[bar 0.1.0] cargo:rerun-if-env-changed=ARFLAGS_x86_64-unknown-linux-gnu
[bar 0.1.0] ARFLAGS_x86_64-unknown-linux-gnu = None
[bar 0.1.0] cargo:rustc-link-lib=static=a
[bar 0.1.0] cargo:rustc-link-search=native=/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out

What are we to learn from 30-line repetition? Nothing. Originally the output at least included compiler command lines, which I for one found way more useful than above listing. But for some reason the command line exposure was made conditional on CC_ENABLE_DEBUG_OUTPUT environment variable. So let's consider the output with the variable set and without -vvv option first.

warning: [email protected]: cc: error: unrecognized command-line option ‘-?’        
warning: [email protected]: cc: fatal error: no input files
warning: [email protected]: compilation terminated.

What are we to learn from this? Less than nothing. Because it's misleading by proclaiming "compilation terminated." More annoyingly we get this three lines for each flag_if_supported() invocation.

But let's move on to -vvv with one flag_is_supported(). Omitting the already mentioned lines we get

[bar 0.1.0] running: "cc" "-E" "/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out/17730175534651035635detect_compiler_family.c"
[bar 0.1.0] # 0 "/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out/17730175534651035635detect_compiler_family.c"
[bar 0.1.0] # 0 "<built-in>"
[bar 0.1.0] # 0 "<command-line>"
[bar 0.1.0] # 1 "/usr/include/stdc-predef.h" 1 3 4
[bar 0.1.0] # 0 "<command-line>" 2
[bar 0.1.0] # 1 "/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out/17730175534651035635detect_compiler_family.c"
[bar 0.1.0] 
[bar 0.1.0] 
[bar 0.1.0] 
[bar 0.1.0] 
[bar 0.1.0] 
[bar 0.1.0] #pragma message "gcc"
[bar 0.1.0] 
[bar 0.1.0] running: "cc" "-?"
[bar 0.1.0] cargo:warning=cc: error: unrecognized command-line option '-?'
[bar 0.1.0] cargo:warning=cc: fatal error: no input files
[bar 0.1.0] cargo:warning=compilation terminated.
[bar 0.1.0] exit status: 1
[bar 0.1.0] running: "cc" "-E" "/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out/6437633726814300714detect_compiler_family.c"
[bar 0.1.0] # 0 "/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out/6437633726814300714detect_compiler_family.c"
[bar 0.1.0] # 0 "<built-in>"
[bar 0.1.0] # 0 "<command-line>"
[bar 0.1.0] # 1 "/usr/include/stdc-predef.h" 1 3 4
[bar 0.1.0] # 0 "<command-line>" 2
[bar 0.1.0] # 1 "/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out/6437633726814300714detect_compiler_family.c"
[bar 0.1.0] 
[bar 0.1.0] 
[bar 0.1.0] 
[bar 0.1.0] 
[bar 0.1.0] 
[bar 0.1.0] #pragma message "gcc"
[bar 0.1.0] 
[bar 0.1.0] running: "cc" "-?"
[bar 0.1.0] cargo:warning=cc: error: unrecognized command-line option '-?'
[bar 0.1.0] cargo:warning=cc: fatal error: no input files
[bar 0.1.0] cargo:warning=compilation terminated.
[bar 0.1.0] exit status: 1
[bar 0.1.0] running: LC_ALL="C" "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out/ea708c7824d36062-a.o" "-c" "src/a.c"
[bar 0.1.0] exit status: 0
[bar 0.1.0] running: LC_ALL="C" "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out/ea708c7824d36062-b.o" "-c" "src/b.c"
[bar 0.1.0] exit status: 0
[bar 0.1.0] running: ZERO_AR_DATE="1" "ar" "cq" "/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out/liba.a" "/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out/ea708c7824d36062-a.o" "/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out/ea708c7824d36062-b.o"
[bar 0.1.0] exit status: 0
[bar 0.1.0] running: "ar" "s" "/home/foo/bar/target/debug/build/bar-a3dff5830754fc93/out/liba.a"
[bar 0.1.0] exit status: 0

What do we learn from repetition? Nothing. What do we learn from the unique output? The very little we learn is effectively negated by the already mentioned misleading "compilation terminated" warning. And we're in total dark why there is duplication.

To summarize. The verbose output is excessively repetitive and appears to be self-serving, which diminishes its usefulness. Just in case for reference, "self-serving" refers the fact that the focus appears to be on providing debugging information for cc-rs maintainers as opposed to make it useful for cc-rs users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions