Skip to content

Not enough information when compiling multiple targets #15177

Open
@ehuss

Description

When cross-compiling multiple targets, cargo currently doesn't provide any console messages that indicate which targets are being built, or which target caused a failure.

For example:

#[cfg(windows)]
compile_error!{"foo"}

Running:

cargo check --target x86_64-pc-windows-msvc --target x86_64-unknown-linux-gnu

causes the following output:

    Checking foo v0.1.0 (/Users/eric/Temp/foo)
error: foo
 --> src/lib.rs:2:1
  |
2 | compile_error!{"foo"}
  | ^^^^^^^^^^^^^^^^^^^^^

error: could not compile `foo` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

There's nothing that says which target caused a failure. This can be difficult to track down if you have a large number of targets, and if the offending code isn't obvious which target caused the failure.

I'm not sure exactly what changes to make to help with this. Maybe have the error message display which target was the offender? Maybe only if multiple targets are involved?

I suspect this is also a problem with per-package-target and artifact dependencies.

cargo 1.86.0-nightly (2928e3273 2025-02-07)
release: 1.86.0-nightly
commit-hash: 2928e32734b04925ee51e1ae88bea9a83d2fd451
commit-date: 2025-02-07
host: aarch64-apple-darwin
libgit2: 1.9.0 (sys:0.20.0 vendored)
libcurl: 8.7.1 (sys:0.4.74+curl-8.9.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Mac OS 14.6.1 [64-bit]

Metadata

Assignees

No one assigned

    Labels

    A-cross-compilingArea: using --target flag for other platformsA-diagnosticsArea: Error and warning messages generated by Cargo itself.S-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions