Преглед на файлове

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.
Fontlos преди 1 месец
родител
ревизия
ad8c869ba2
променени са 1 файла, в които са добавени 4 реда и са изтрити 0 реда
  1. 4 0
      packages/cli/src/cli/link.rs

+ 4 - 0
packages/cli/src/cli/link.rs

@@ -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"))?;