@@ -119,18 +119,25 @@ impl Archive {
119119    } 
120120
121121    fn  find_library ( & self ,  name :  & str )  -> Path  { 
122-         let  ( prefix ,  ext )  = match  self . sess . targ_cfg . os  { 
122+         let  ( osprefix ,  osext )  = match  self . sess . targ_cfg . os  { 
123123            abi:: OsWin32  => ( "" ,  "lib" ) ,  _ => ( "lib" ,  "a" ) , 
124124        } ; 
125-         let  libname = format ! ( "{}{}.{}" ,  prefix,  name,  ext) ; 
125+         // On windows, static libraries sometimes show up as libfoo.a and other 
126+         // times show up as foo.lib 
127+         let  oslibname = format ! ( "{}{}.{}" ,  osprefix,  name,  osext) ; 
128+         let  unixlibname = format ! ( "lib{}.a" ,  name) ; 
126129
127130        let  mut  rustpath = filesearch:: rust_path ( ) ; 
128131        rustpath. push ( self . sess . filesearch . get_target_lib_path ( ) ) ; 
129132        let  path = self . sess . opts . addl_lib_search_paths . iter ( ) ; 
130133        for  path in  path. chain ( rustpath. iter ( ) )  { 
131134            debug ! ( "looking for {} inside {}" ,  name,  path. display( ) ) ; 
132-             let  test = path. join ( libname . clone ( ) ) ; 
135+             let  test = path. join ( oslibname . as_slice ( ) ) ; 
133136            if  test. exists ( )  {  return  test } 
137+             if  oslibname != unixlibname { 
138+                 let  test = path. join ( unixlibname. as_slice ( ) ) ; 
139+                 if  test. exists ( )  {  return  test } 
140+             } 
134141        } 
135142        self . sess . fatal ( format ! ( "could not find native static library `{}`, \  
136143,  name) ) ; 
0 commit comments