Skip to content

bootstrap doesn't handle LLVM submodule updates #152969

@ZuseZ4

Description

@ZuseZ4

Summary

If we build rustc with the llvm submodule enabled (as opposed to downloading ci-llvm), then we get an LLVM for a specific Version/Commit. If the LLVM submodule gets updated, then old artifacts remain in the llvm build dir, while we build the new llvm. The chances that this causes linker errors are very high. Last time encountered in: #wg-autodiff > ✔ rustc build failing @ 💬, but a few other people I talked to and I also learned it the same way. The solution is to rm -rf build, since x clean doesn't touch the llvm folder.

Command used

any build command

Expected behaviour

builds

Actual behaviour

This error mentions autodiff, but it can be encountered in different versions without autodiff as well.
error: failed to load our autodiff backend: DlOpen { source: "/home/jonathan/Projects/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libEnzyme-22.so: undefined symbol: _ZN4llvm11APFloatBase18semPPCDoubleDoubleE" }

Bootstrap configuration (bootstrap.toml)

any that does not use download-ci-llvm=true

Operating system

linux (but likely others as well)

HEAD

encountered over multiple llvm versions

Additional context

Imho we should check if the submodule checkout matches build artifacts in the llvm build dir, and error if not.
We shouldn't warn, since I don't think it will ever work. We imho also shouldn't delete the llvm build dir for users, as it's slow to build and maybe he would rather do something else (like change branches) than loosing his llvm artifacts.

Build Log

<log>

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions