File tree 1 file changed +10
-3
lines changed
src/librustc_codegen_ssa/back
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1002,15 +1002,22 @@ fn get_crt_libs_path(sess: &Session) -> Option<PathBuf> {
1002
1002
x if x == "x86" => "i686" ,
1003
1003
x => x,
1004
1004
} ;
1005
+ let mingw_bits = & sess. target . target . target_pointer_width ;
1005
1006
let mingw_dir = format ! ( "{}-w64-mingw32" , mingw_arch) ;
1006
1007
// Here we have path/bin/gcc but we need path/
1007
1008
let mut path = linker_path;
1008
1009
path. pop ( ) ;
1009
1010
path. pop ( ) ;
1010
- // Based on Clang MinGW driver
1011
- let probe_paths = vec ! [ "lib" , "sys-root/mingw/lib" ] ;
1011
+ // Loosely based on Clang MinGW driver
1012
+ let probe_paths = vec ! [
1013
+ path. join( & mingw_dir) . join( "lib" ) , // Typical path
1014
+ path. join( & mingw_dir) . join( "sys-root/mingw/lib" ) , // Rare path
1015
+ path. join( format!(
1016
+ "lib/mingw/tools/install/mingw{}/{}/lib" ,
1017
+ & mingw_bits, & mingw_dir
1018
+ ) ) , // Chocolatey is creative
1019
+ ] ;
1012
1020
for probe_path in probe_paths {
1013
- let probe_path = path. join ( & mingw_dir) . join ( & probe_path) ;
1014
1021
if probe_path. join ( "crt2.o" ) . exists ( ) {
1015
1022
return Some ( probe_path) ;
1016
1023
} ;
You can’t perform that action at this time.
0 commit comments