Skip to content

Commit e5a4101

Browse files
committed
Moved the system lib check not to prevent taking the static linking branch.
1 parent 3cf9b12 commit e5a4101

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/lib.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -430,18 +430,25 @@ impl Library {
430430
}
431431
"-l" => {
432432
self.libs.push(val.to_string());
433-
if statik && !is_system(val, &dirs) {
434-
let meta = format!("rustc-link-lib=static={}", val);
435-
config.print_metadata(&meta);
436-
} else {
437-
let meta = format!("rustc-link-lib={}", val);
438-
config.print_metadata(&meta);
439-
}
440433
}
441434
_ => {}
442435
}
443436
}
444437

438+
for val in &self.libs {
439+
if statik {
440+
if is_system(val, &dirs) {
441+
panic!("The library \"{}\" is a system library, \
442+
which means it can't be linked statically!", val);
443+
}
444+
let meta = format!("rustc-link-lib=static={}", val);
445+
config.print_metadata(&meta);
446+
} else {
447+
let meta = format!("rustc-link-lib={}", val);
448+
config.print_metadata(&meta);
449+
}
450+
}
451+
445452
let mut iter = output.trim_right().split(' ');
446453
while let Some(part) = iter.next() {
447454
if part != "-framework" {

0 commit comments

Comments
 (0)