Rebuild if deployment target changes
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
rustc reads the MACOSX_DEPLOYMENT_TARGET environment variable (and similar other *_DEPLOYMENT_TARGET variables), and uses that value to determine (probably amongst other things) certain options for LLVM and the linker.
However, it seems like this environment variable is not tracked as an external dependency, meaning that changing it does not cause rustc/cargo to rebuild the target, as is otherwise expected when changing environment variables that modify compilation.
E.g. running the following code:
cargo clean
MACOSX_DEPLOYMENT_TARGET=12.0 cargo build
MACOSX_DEPLOYMENT_TARGET=13.0 cargo build
I expected to see this happen: The project was built twice.
Instead, this happened: The project was built once, and then the cache was used the second time.
Meta
rustc --version --verbose:
rustc 1.76.0-nightly (2f8d81f9d 2023-11-21)
binary: rustc
commit-hash: 2f8d81f9dbac6b8df982199f69da04a4c8357227
commit-date: 2023-11-21
host: aarch64-apple-darwin
release: 1.76.0-nightly
LLVM version: 17.0.5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with compiler/rustc_target/src/spec/base/apple/mod.rs at the environment-variable handling referenced in the issue, then trace how deployment-target variables become external build dependencies. Reproduce the behavior with the two MACOSX_DEPLOYMENT_TARGET cargo builds. Done means changing the deployment target causes the target to rebuild, with regression coverage for the demonstrated sequence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 44/100