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

Make rust build deterministic #1213

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

bmwiedemann
Copy link

Summary

We disable LTO and use codegen-units = 1 for deterministic build results of the rust code.
See https://reproducible-builds.org/ for why this is good.

rust-lang/rust#128675 states that the default codegen-units = 16 should be deterministic, but here it clearly is not.

Test Plan

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 25, 2024
@zsol
Copy link
Member

zsol commented Sep 25, 2024

Hey @bmwiedemann thanks for the PR!

here it clearly is not

Could you help me understand why not? How can I reproduce this nondeterminism?

@bmwiedemann
Copy link
Author

I just did two clean builds as similar as possible. Same CPU, same username, same path, same timezone, locale, umask, date... and it still differed in the /usr/lib64/python3.12/site-packages/libcst/native.cpython-312-x86_64-linux-gnu.so

https://rb.zq1.de/compare.factory-20240904/diffs/python-libcst-compare.out shows a (partially filtered) diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants