cargo-semver-checks: error: output of --print=file-names missing when learning about target-specific information from rustc when `--target` is specified
Steps to reproduce the bug with the above code
Thanks for this great tool!
I see a bunch of these repos whos semver-checks results on non-host (x86_64-unknown-linux-gnu) targets report as the title shows. One of the repos is https://github.com/arceos-org/arm_gicv2 . (I can list more if needed.)
Reproducible commands:
# latest hash: https://github.com/arceos-org/arm_gicv2/commit/cf756f7623b6b6af2f6fe423d1da19ebe96e7e1d
git clone https://github.com/arceos-org/arm_gicv2.git
cd arm_gicv2
rustup target add aarch64-unknown-none-softfloat
cargo semver-checks --target aarch64-unknown-none-softfloat
Actual Behaviour
I got compilation error from rustc.
error: output of --print=file-names missing when learning about target-specific information from rustc
command was: `/root/.cargo/bin/sccache /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names --cap-lints=allow --target aarch64-unknown-none-softfloat --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg`
--- stdout
___
lib___.rlib
lib___.a
/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu
off
___
debug_assertions
fmt_debug="full"
overflow_checks
panic="abort"
proc_macro
relocation_model="static"
target_abi="softfloat"
target_arch="aarch64"
target_endian="little"
target_env=""
target_has_atomic
target_has_atomic="128"
target_has_atomic="16"
target_has_atomic="32"
target_has_atomic="64"
target_has_atomic="8"
target_has_atomic="ptr"
target_has_atomic_equal_alignment="128"
target_has_atomic_equal_alignment="16"
target_has_atomic_equal_alignment="32"
target_has_atomic_equal_alignment="64"
target_has_atomic_equal_alignment="8"
target_has_atomic_equal_alignment="ptr"
target_has_atomic_load_store
target_has_atomic_load_store="128"
target_has_atomic_load_store="16"
target_has_atomic_load_store="32"
target_has_atomic_load_store="64"
target_has_atomic_load_store="8"
target_has_atomic_load_store="ptr"
target_os="none"
target_pointer_width="64"
target_vendor="unknown"
ub_checks
-----
error: failed to build rustdoc for crate arm_gicv2 v0.1.0
note: this is usually due to a compilation error in the crate,
and is unlikely to be a bug in cargo-semver-checks
note: the following command can be used to reproduce the compilation error:
cargo new --lib example &&
cd example &&
echo '[workspace]' >> Cargo.toml &&
cargo add --path /rust/tmp/os-checker/repos/arm_gicv2 &&
cargo check
error: aborting due to failure to build rustdoc for crate arm_gicv2 v0.1.0
I also run the suggested commands to reproduce the compilation error, and it compiles just fine.
Expected Behaviour
There should be no compilation errors.
Generated System Information
Software version
cargo-semver-checks 0.38.0 (507393d-modified)
Operating system
- OS: Linux (Ubuntu 24.04)
- Kernel: 6.8.0-51-generic
Command-line
/root/.cargo/bin/cargo-semver-checks semver-checks --bugreport
cargo version
> cargo -V
cargo 1.85.0-nightly (c86f4b3a1 2024-12-24)
Compile time information
- Profile: release
- Target triple: x86_64-unknown-linux-gnu
- Family: unix
- OS: linux
- Architecture: x86_64
- Pointer width: 64
- Endian: little
- CPU features: fxsr,sse,sse2,x87
- Host: x86_64-unknown-linux-gnu
Cargo build configuration:
[build]
rustc-wrapper = "/root/.cargo/bin/sccache"
Build Configuration
None.
Additional Context
I think it might be a bug with RUSTFLAGS. When I look into the generated cargo doc command from semver-checks, it’s like the following
export RUSTC_BOOTSTRAP=1
export RUSTDOCFLAGS="-Z unstable-options --document-private-items --document-hidden-items --output-format=json --cap-lints=allow"
export RUSTFLAGS=--cap-lints=allow
cargo doc --manifest-path target/semver-checks/local-arm_gicv2-0_1_0-01666ec060466c14/Cargo.toml --target-dir arm_gicv2/target/semver-checks/local-arm_gicv2-0_1_0-01666ec060466c14/target --package arm_gicv2@0.1.0 --lib --target aarch64-unknown-none-softfloat --no-deps --color=always
This just results in the exact same error report as above. (I’m not sure if the hash string in path is the same for your local testing.)
And when RUSTFLAGS=--cap-lints=allow is not included, it compiles and successfully generates the doc.
So I try removing RUSTFLAGS from run_cargo_doc fn, install it locally, and run cargo semver-checks --target aarch64-unknown-none-softfloat agian, semver-checks just works.
Building arm_gicv2 v0.1.0 (current)
Built [ 0.733s] (current)
Parsing arm_gicv2 v0.1.0 (current)
Parsed [ 0.002s] (current)
Building arm_gicv2 v0.1.0 (baseline)
Built [ 0.558s] (baseline)
Parsing arm_gicv2 v0.1.0 (baseline)
Parsed [ 0.002s] (baseline)
Checking arm_gicv2 v0.1.0 -> v0.1.0 (no change)
Checked [ 0.020s] 120 checks: 120 pass, 0 skip
Summary no semver update required
Finished [ 3.697s] arm_gicv2
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 16 (6 by maintainers)
Commits related to this issue
- init: ref https://github.com/obi1kenobi/cargo-semver-checks/issues/1068 — committed to os-checker/MRE-rustflags-bug by zjp-CN 2 years ago
- fix(--target): RUSTDOCFLAGS=--cap-lints=warn close https://github.com/obi1kenobi/cargo-semver-checks/issues/1068 Cargo relies on warning diagnostics to find information, --cap-lints=allow eliminates... — committed to os-checker/cargo-semver-checks by zjp-CN 2 years ago
- test(specified_target): add with_{env_var,flag}_aarch64_unknown_none Both testcases require `rustup target add x86_64-unknown-linux-gnu`. But currently, cargo has a bug for learning target info: co... — committed to os-checker/cargo-semver-checks by zjp-CN 2 years ago
- fix(--target): RUSTDOCFLAGS=--cap-lints=warn close https://github.com/obi1kenobi/cargo-semver-checks/issues/1068 Cargo relies on warning diagnostics to find information, --cap-lints=allow eliminates... — committed to os-checker/cargo-semver-checks by zjp-CN 2 years ago
For passing
--cap-lintsit hasn’t. I got flu this week so is in a slow mode. Will ping people on Zulip asking https://github.com/rust-lang/rust/issues/54282I believe https://github.com/rust-lang/cargo/pull/15036 should fix this. It will get into the main rust-lang/rust repo on Friday, so expect to see it on nightly in the weekend!
Oh I see now. For
--cap-lints, the behavior for this flag is the first occurrence wins https://github.com/rust-lang/rust/issues/54282. I am unsure if we really want to and can depend on it.😄 I’d like to open one on rust-lang repo. I’ll try to make reproducible code that can be run without cargo-semver-checks.