Skip to content

Bootstrap assumes llvm-dwp is sibling of llvm-config instead of inside bindir #81949

Closed
@dtolnay

Description

@dtolnay

The incorrect way: assuming llvm-dwp exists in the parent directory of the path provided for llvm-config. In general these two paths cannot be assumed to have any relationship to one another.

rust/src/bootstrap/compile.rs

Lines 1075 to 1079 in 87bacf2

let src_exe = exe("llvm-dwp", target_compiler.host);
let dst_exe = exe("rust-llvm-dwp", target_compiler.host);
let llvm_config_bin = builder.ensure(native::Llvm { target: target_compiler.host });
let llvm_bin_dir = llvm_config_bin.parent().unwrap();
builder.copy(&llvm_bin_dir.join(&src_exe), &libdir_bin.join(&dst_exe));


The correct way: run llvm-config --bindir using the provided llvm-config, and pick llvm-dwp inside of the directory that it returns. Bootstrap does this correctly elsewhere, such as for FileCheck:

rust/src/bootstrap/lib.rs

Lines 669 to 671 in 87bacf2

} else if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
let llvm_bindir = output(Command::new(s).arg("--bindir"));
let filecheck = Path::new(llvm_bindir.trim()).join(exe("FileCheck", target));

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions