File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,19 @@ fn main() {
128
128
// of llvm-config, not the target that we're attempting to link.
129
129
let mut cmd = Command :: new ( & llvm_config) ;
130
130
cmd. arg ( "--libs" ) ;
131
+
132
+ // Force static linking with "--link-static" if available.
133
+ let mut version_cmd = Command :: new ( & llvm_config) ;
134
+ version_cmd. arg ( "--version" ) ;
135
+ let version_output = output ( & mut version_cmd) ;
136
+ let mut parts = version_output. split ( '.' ) ;
137
+ if let ( Some ( major) , Some ( minor) ) = ( parts. next ( ) . and_then ( |s| s. parse :: < u32 > ( ) . ok ( ) ) ,
138
+ parts. next ( ) . and_then ( |s| s. parse :: < u32 > ( ) . ok ( ) ) ) {
139
+ if major > 3 || ( major == 3 && minor >= 8 ) {
140
+ cmd. arg ( "--link-static" ) ;
141
+ }
142
+ }
143
+
131
144
if !is_crossed {
132
145
cmd. arg ( "--system-libs" ) ;
133
146
}
You can’t perform that action at this time.
0 commit comments