rust-lang / rust-lang/cargo

Dependencies are still built after a build script error

Open
#832 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-build-execution A-build-scripts A-diagnostics S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

E.g.

[package]

name = "a"
version = "0.0.1"
authors = []
build = "build.rs"

[dependencies.compile_msg]
git = "https://github.com/huonw/compile_msg"
fn main() { std::os::set_exit_status(1) }
$ cargo clean && cargo build
   Compiling a v0.0.1 (file:///home/huon/projects/test-rust/tmp/a)
   Compiling compile_msg v0.1.0 (https://github.com/huonw/compile_msg#569c6f18)
Build failed, waiting for other jobs to finish...
Failed to run custom build command for `a v0.0.1 (file:///home/huon/projects/test-rust/tmp/a)`
Process didn't exit successfully: `/home/huon/projects/test-rust/tmp/a/target/build/a-609ef28031a9b714/build-script-build` (status=1)

Dependencies could take a long time to compile (e.g. in servo), and fixing the problem raised by the build script may require adjustments that force many dependencies to be rebuild anyway, so it seems reasonable to at least give some indication that the build script failed immediately when it fails.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided Cargo package, build.rs script, and cargo clean && cargo build command, then trace how Cargo handles a failed build script while dependency jobs are still running. Done means the failure is reported immediately and unnecessary dependency compilation does not continue after the script error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.