We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 161f262 commit bcfbbd8Copy full SHA for bcfbbd8
src/librustc_llvm/build.rs
@@ -128,6 +128,19 @@ fn main() {
128
// of llvm-config, not the target that we're attempting to link.
129
let mut cmd = Command::new(&llvm_config);
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
144
if !is_crossed {
145
cmd.arg("--system-libs");
146
}
0 commit comments