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

Fix bootstrap failing to copy rust-llvm-dwp when cross-compiling rustc #91270

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/bootstrap/compile.rs
Expand Up @@ -1161,8 +1161,14 @@ impl Step for Assemble {
let dst_exe = exe("rust-llvm-dwp", target_compiler.host);
let llvm_config_bin = builder.ensure(native::Llvm { target: target_compiler.host });
if !builder.config.dry_run {
let llvm_bin_dir = output(Command::new(llvm_config_bin).arg("--bindir"));
let llvm_bin_dir = Path::new(llvm_bin_dir.trim());
let llvm_bin_dir = if target_compiler.host == build_compiler.host {
let llvm_bin_dir = output(Command::new(llvm_config_bin).arg("--bindir"));
PathBuf::from(llvm_bin_dir.trim())
} else {
// if cross-compiling don't copy from the llvm directory for the target instead
builder.llvm_out(target_compiler.host).join("build/bin")
};
Copy link
Member

Choose a reason for hiding this comment

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

So I admit I may just be confused -- but it feels like llvm_bin_dir should ~match with llvm_config_bin returned from native::Llvm invocation? In particular, I would expect llvm-config to be in the same directory as llvm-dwp. So maybe we should skip the --bindir invocation regardless of cross-compilation and just copy llvm_config_bin.with_filename(src_exe)?

If that doesn't work -- presumably for the reason we started invoking bindir here -- it would be good to figure out why. Because it seems like the new code makes the assumption that it should work, which can then presumably fail for whatever reason we started using --bindir.

In some sense I guess this gets at "why does --bindir not work for cross-compilation"?


builder.copy(&llvm_bin_dir.join(&src_exe), &libdir_bin.join(&dst_exe));
}
}
Expand Down