Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align opt-level for crate build deps #1155

Merged
merged 2 commits into from
Oct 12, 2020

Conversation

bcressey
Copy link
Contributor

@bcressey bcressey commented Oct 9, 2020

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.

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.

Signed-off-by: Ben Cressey <[email protected]>
@bcressey bcressey requested review from zmrow and webern October 9, 2020 23:08
Copy link
Contributor

@webern webern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works 🍪

Copy link
Contributor

@zmrow zmrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey look at that! We can build again!

🎖️

@bcressey bcressey merged commit bffcc55 into bottlerocket-os:develop Oct 12, 2020
@bcressey bcressey deleted the cargo-build-override branch October 12, 2020 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rust 1.47.0 is causing CI to fail
3 participants