From b3b252b401ad133fac6d7ea2b452da921ff7f3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Fri, 21 Feb 2020 15:35:31 +0100 Subject: [PATCH] Fix MinGW detection for Cygwin --- src/librustc_codegen_ssa/back/link.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs index aaa4448fc19..33036d97dfa 100644 --- a/src/librustc_codegen_ssa/back/link.rs +++ b/src/librustc_codegen_ssa/back/link.rs @@ -1008,14 +1008,13 @@ fn get_crt_libs_path(sess: &Session) -> Option { path.pop(); path.pop(); // Based on Clang MinGW driver - let probe_path = path.join(&mingw_dir).join("lib"); - if probe_path.exists() { - return Some(probe_path); - }; - let probe_path = path.join(&mingw_dir).join("sys-root/mingw/lib"); - if probe_path.exists() { - return Some(probe_path); - }; + let probe_paths = vec!["lib", "sys-root/mingw/lib"]; + for probe_path in probe_paths { + let probe_path = path.join(&mingw_dir).join(&probe_path); + if probe_path.join("crt2.o").exists() { + return Some(probe_path); + }; + } }; }; None