From bf0de6c6791cf9cb1ddedaabf140566cc2216f50 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Thu, 14 Dec 2023 20:25:09 +0300 Subject: [PATCH] fix `x clean` for cross-compiled artifacts Signed-off-by: onur-ozkan --- src/bootstrap/src/core/build_steps/clean.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/clean.rs b/src/bootstrap/src/core/build_steps/clean.rs index 6372db96afb..4b993945f19 100644 --- a/src/bootstrap/src/core/build_steps/clean.rs +++ b/src/bootstrap/src/core/build_steps/clean.rs @@ -149,8 +149,14 @@ fn clean_default(build: &Build) { rm_rf(&build.out.join("bootstrap-shims-dump")); rm_rf(&build.out.join("rustfmt.stamp")); - for host in &build.hosts { - let entries = match build.out.join(host.triple).read_dir() { + let mut hosts: Vec<_> = build.hosts.iter().map(|t| build.out.join(t.triple)).collect(); + // After cross-compilation, artifacts of the host architecture (which may differ from build.host) + // might not get removed. + // Adding its path (linked one for easier accessibility) will solve this problem. + hosts.push(build.out.join("host")); + + for host in hosts { + let entries = match host.read_dir() { Ok(iter) => iter, Err(_) => continue, };