diff options
| author | Mateusz Mikuła <mati865@gmail.com> | 2020-02-21 16:47:04 +0100 |
|---|---|---|
| committer | Mateusz Mikuła <mati865@gmail.com> | 2020-02-21 16:47:04 +0100 |
| commit | 4904b9c228317a9cba963afb87425754a586acf2 (patch) | |
| tree | 9a8ef9adb8b9813582d2425b9f3de91023ab989a | |
| parent | b3b252b401ad133fac6d7ea2b452da921ff7f3b4 (diff) | |
| download | rust-4904b9c228317a9cba963afb87425754a586acf2.tar.gz rust-4904b9c228317a9cba963afb87425754a586acf2.zip | |
Detect Chocolatey MinGW installation
| -rw-r--r-- | src/librustc_codegen_ssa/back/link.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs index 33036d97dfa..78aacc56ea4 100644 --- a/src/librustc_codegen_ssa/back/link.rs +++ b/src/librustc_codegen_ssa/back/link.rs @@ -1002,15 +1002,22 @@ fn get_crt_libs_path(sess: &Session) -> Option<PathBuf> { x if x == "x86" => "i686", x => x, }; + let mingw_bits = &sess.target.target.target_pointer_width; let mingw_dir = format!("{}-w64-mingw32", mingw_arch); // Here we have path/bin/gcc but we need path/ let mut path = linker_path; path.pop(); path.pop(); - // Based on Clang MinGW driver - let probe_paths = vec!["lib", "sys-root/mingw/lib"]; + // Loosely based on Clang MinGW driver + let probe_paths = vec![ + path.join(&mingw_dir).join("lib"), // Typical path + path.join(&mingw_dir).join("sys-root/mingw/lib"), // Rare path + path.join(format!( + "lib/mingw/tools/install/mingw{}/{}/lib", + &mingw_bits, &mingw_dir + )), // Chocolatey is creative + ]; 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); }; |
