- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.7k
 
Open
Labels
A-build-scriptsArea: build.rs scriptsArea: build.rs scriptsA-diagnosticsArea: Error and warning messages generated by Cargo itself.Area: Error and warning messages generated by Cargo itself.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-treeS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
Description
Problem
I'm running cargo build --bin foo (with cross-compilation, custom compiler, large workspace, feature flags, etc etc).
Build fails:
...
   Compiling openssl-sys v0.9.110
error: failed to run custom build command for `openssl-sys v0.9.110`
...
warning: build failed, waiting for other jobs to finish...
Why was openssl even compiled? It is not supposed to be in the dependency tree. I run cargo tree -p foo-pkg, and openssl-sys it is nowhere there. I'm stuck. (I'm not asking for help with openssl here, this is an illustration.)
Proposed Solution
When build fails, print a graph path leading to the dependency that failed to build. Like this:
   Compiling openssl-sys v0.9.110
error: failed to run custom build command for `openssl-sys v0.9.110`
...
openssl-sys was compiled because it is dependency of openssl
... which is dependency of native-tls
... which is a build dependency of aaa
... which is a dependency of foo-pkg
warning: build failed, waiting for other jobs to finish...
Notes
buck2 does something similar for every error: it prints dependency graph path leading to an error, for example:
Error running analysis for `root//:main (prelude//platforms:default#f6691640831d48dd)`
Caused by:
    0: Error looking up configured node root//:main (prelude//platforms:default#f6691640831d48dd)
    1: Error looking up configured node toolchains//:java (prelude//platforms:default#f6691640831d48dd) (prelude//platforms:default#f6691640831d48dd)
    2: looking up unconfigured target node `toolchains//:java`
    3: Unknown target `java` from package `toolchains//`.
Metadata
Metadata
Assignees
Labels
A-build-scriptsArea: build.rs scriptsArea: build.rs scriptsA-diagnosticsArea: Error and warning messages generated by Cargo itself.Area: Error and warning messages generated by Cargo itself.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-treeS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.