Skip to content

nondeterminism from codegen-units #128675

@bmwiedemann

Description

@bmwiedemann

While working on reproducible builds for openSUSE (sponsored by the NLnet NGI0 fund), I found that
compiling various rust applications with the default of codegen-units=16, it produced nondeterministic variations in resulting binaries. e.g.
pop-os/launcher#230

IMHO, the default settings should be made to behave deterministically. Either make codegen-units=1 the default or ensure that codegen-units=16 can produce deterministic results.

In the unlikely event that this is not possible, it should clearly be documented how to achieve reproducible builds, not only in
https://doc.rust-lang.org/rustc/codegen-options/index.html#codegen-units

This is about rust1.79 but started much earlier. At least with 1.73

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationA-reproducibilityArea: Reproducible / deterministic buildsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions