File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ fn main() {
14
14
println ! (
15
15
"cargo:rustc-env={}={}" ,
16
16
"LINKER" ,
17
- env:: var( "CC" ) . unwrap_or( "cc " . to_string( ) )
17
+ env:: var( "CC" ) . unwrap_or( "" . to_string( ) )
18
18
) ;
19
19
println ! ( "cargo:rerun-if-changed-env=TARGET" )
20
20
}
Original file line number Diff line number Diff line change @@ -31,20 +31,24 @@ pub fn compile_test<P: AsRef<Path>>(
31
31
canonicalize( crate_path) ?. display( )
32
32
) ?;
33
33
writeln ! ( file, "include!(r#\" {}.rs\" #);" , library_file. display( ) ) ?;
34
- let output = Command :: new ( rustc)
35
- . arg ( & rust_file)
34
+ let mut cmd = Command :: new ( rustc) ;
35
+ cmd . arg ( & rust_file)
36
36
. arg ( format ! ( "-Lnative={}" , output_dir. display( ) ) )
37
37
. arg ( format ! (
38
38
"-lstatic={}" ,
39
39
library_file. file_stem( ) . unwrap( ) . to_str( ) . unwrap( )
40
40
) )
41
41
. arg ( "--target" )
42
42
. arg ( env:: var ( "TARGET_PLATFORM" ) . unwrap ( ) )
43
- . arg ( format ! ( "-Clinker={}" , env:: var( "LINKER" ) . unwrap( ) ) )
44
43
. arg ( "-o" )
45
44
. arg ( & binary_path)
46
- . arg ( "-Aunused" )
47
- . output ( ) ?;
45
+ . arg ( "-Aunused" ) ;
46
+
47
+ let linker = env:: var ( "LINKER" ) . unwrap ( ) ;
48
+ if !linker. is_empty ( ) {
49
+ cmd. arg ( format ! ( "-Clinker={}" , linker) ) ;
50
+ }
51
+ let output = cmd. output ( ) ?;
48
52
49
53
if !output. status . success ( ) {
50
54
return Err ( std:: str:: from_utf8 ( & output. stderr ) ?. into ( ) ) ;
You can’t perform that action at this time.
0 commit comments