align opt-level for crate build deps #1155
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue number:
Fixes #1153
Description of changes:
Our OS packages are built as a byproduct of build script execution, while the final Rust artifacts are largely ignored.
Since Rust 1.47.0, cargo builds host dependencies like build scripts with opt-level "0" by default, which did not match the "z" level we picked to minimize the size of the output artifacts.
This caused package build dependencies to be built more than once, with concurrent Docker builds for the same package. This is wasteful and creates races that our build tool does not handle gracefully.
By aligning the opt-level we restore the previous behavior.
Testing done:
Built locally using Rust 1.47, with and without the change applied.
Without the change, packages like glibc were built more than once. With the change, they are only built once.
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.