fix(cli): filter out .lib files when targeting Android (#4130)

When building for Android, the linker may incorrectly pick up Windows-specific
.lib files (e.g., from embed-resource) even with proper #[cfg] guards in build.rs.
This explicitly filters out .lib files from linker arguments when the target
environment is Android to prevent linkage failures.
This commit is contained in:
Fontlos authored and GitHub committed 2025-05-23 12:39:19 +01:00
1 parent f557fd4d3b
commit ad8c869ba2
1 file changed
+4
+4
View File
@@ -129,6 +129,10 @@ impl LinkAction {
handle_linker_command_file(&mut args);
if self.triple.environment == target_lexicon::Environment::Android {
args.retain(|arg| !arg.ends_with(".lib"));
}
// Write the linker args to a file for the main process to read
// todo: we might need to encode these as escaped shell words in case newlines are passed
std::fs::write(&self.link_args_file, args.join("\n"))?;