From 2cd4f6737533e6a72fa7ac8d4bba3e3d2c6b7ac9 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Sat, 11 Oct 2025 15:38:48 -0400 Subject: [PATCH] Clean the sysroot destination directory before copying the content into it --- build_system/src/build.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build_system/src/build.rs b/build_system/src/build.rs index 94b40319f4a..6aa5faec4c8 100644 --- a/build_system/src/build.rs +++ b/build_system/src/build.rs @@ -149,6 +149,9 @@ pub fn build_sysroot(env: &HashMap, config: &ConfigInfo) -> Resu // Copy files to sysroot let sysroot_path = start_dir.join(format!("sysroot/lib/rustlib/{}/lib/", config.target_triple)); + // To avoid errors like "multiple candidates for `rmeta` dependency `core` found", we clean the + // sysroot directory before copying the sysroot build artifacts. + let _ = fs::remove_dir_all(&sysroot_path); create_dir(&sysroot_path)?; let mut copier = |dir_to_copy: &Path| { // FIXME: should not use shell command!