From 320c47ef1c222962cfb26764de34cd8ffd688b0e Mon Sep 17 00:00:00 2001 From: jam1garner <8260240+jam1garner@users.noreply.github.com> Date: Fri, 26 Nov 2021 16:47:28 -0500 Subject: [PATCH 1/3] Fix bootstrap failing to copy rust-llvm-dwp when cross-compiling rustc --- src/bootstrap/compile.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 007ca9f7f5a92..e345b5a6fdacc 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -1161,9 +1161,16 @@ 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()); - builder.copy(&llvm_bin_dir.join(&src_exe), &libdir_bin.join(&dst_exe)); + if target_compiler.host == build_compiler.host { + let llvm_bin_dir = output(Command::new(llvm_config_bin).arg("--bindir")); + let llvm_bin_dir = Path::new(llvm_bin_dir.trim()); + builder.copy(&llvm_bin_dir.join(&src_exe), &libdir_bin.join(&dst_exe)); + } else { + // if cross-compiling don't copy the llvm directory for the target instead + let llvm_bin_dir = format!("build/{}/llvm/build/bin", target_compiler.host); + let llvm_bin_dir = Path::new(&llvm_bin_dir); + builder.copy(&llvm_bin_dir.join(&src_exe), &libdir_bin.join(&dst_exe)); + } } } From 5ac06621eeeaaefac03df2d61d7b4f0e5e2a9d66 Mon Sep 17 00:00:00 2001 From: jam1garner <8260240+jam1garner@users.noreply.github.com> Date: Fri, 26 Nov 2021 17:34:46 -0500 Subject: [PATCH 2/3] Simplfy bootstrap rust-llvm-dwp copying --- src/bootstrap/compile.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index e345b5a6fdacc..3c9850377276d 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -1161,16 +1161,15 @@ 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 { - if target_compiler.host == build_compiler.host { + let llvm_bin_dir = if target_compiler.host == build_compiler.host { let llvm_bin_dir = output(Command::new(llvm_config_bin).arg("--bindir")); - let llvm_bin_dir = Path::new(llvm_bin_dir.trim()); - builder.copy(&llvm_bin_dir.join(&src_exe), &libdir_bin.join(&dst_exe)); + PathBuf::from(llvm_bin_dir.trim()) } else { - // if cross-compiling don't copy the llvm directory for the target instead - let llvm_bin_dir = format!("build/{}/llvm/build/bin", target_compiler.host); - let llvm_bin_dir = Path::new(&llvm_bin_dir); - builder.copy(&llvm_bin_dir.join(&src_exe), &libdir_bin.join(&dst_exe)); - } + // if cross-compiling don't copy from the llvm directory for the target instead + PathBuf::from(format!("build/{}/llvm/build/bin", target_compiler.host)) + }; + + builder.copy(&llvm_bin_dir.join(&src_exe), &libdir_bin.join(&dst_exe)); } } From 282760a246ef4a7ec347c8a40c41b998bd6f7e7f Mon Sep 17 00:00:00 2001 From: jam1garner <8260240+jam1garner@users.noreply.github.com> Date: Sat, 27 Nov 2021 00:49:49 -0500 Subject: [PATCH 3/3] Clean up bootstrap llvm-dwp path building --- src/bootstrap/compile.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 3c9850377276d..443e4403b9a90 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -1166,7 +1166,7 @@ impl Step for Assemble { PathBuf::from(llvm_bin_dir.trim()) } else { // if cross-compiling don't copy from the llvm directory for the target instead - PathBuf::from(format!("build/{}/llvm/build/bin", target_compiler.host)) + builder.llvm_out(target_compiler.host).join("build/bin") }; builder.copy(&llvm_bin_dir.join(&src_exe), &libdir_bin.join(&dst_exe));