Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit f8747f0

Browse files
committed
Fix aarch64 cross compilation
1 parent 8ec3d20 commit f8747f0

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

build_system/tests.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ struct TestRunner {
322322
out_dir: PathBuf,
323323
jit_supported: bool,
324324
rust_flags: String,
325-
run_wrapper: String,
325+
run_wrapper: Vec<String>,
326326
host_triple: String,
327327
target_triple: String,
328328
}
@@ -339,18 +339,18 @@ impl TestRunner {
339339
let jit_supported = target_triple.contains("x86_64") && is_native;
340340

341341
let mut rust_flags = env::var("RUSTFLAGS").ok().unwrap_or("".to_string());
342-
let mut run_wrapper = String::new();
342+
let mut run_wrapper = Vec::new();
343343

344344
if !is_native {
345345
match target_triple.as_str() {
346346
"aarch64-unknown-linux-gnu" => {
347347
// We are cross-compiling for aarch64. Use the correct linker and run tests in qemu.
348-
rust_flags = format!("-Clinker=aarch64-linux-gnu-gcc {}", rust_flags);
349-
run_wrapper = "qemu-aarch64 -L /usr/aarch64-linux-gnu".to_string();
348+
rust_flags = format!("-Clinker=aarch64-linux-gnu-gcc{}", rust_flags);
349+
run_wrapper = vec!["qemu-aarch64", "-L", "/usr/aarch64-linux-gnu"];
350350
},
351351
"x86_64-pc-windows-gnu" => {
352352
// We are cross-compiling for Windows. Run tests in wine.
353-
run_wrapper = "wine".to_string();
353+
run_wrapper = vec!["wine"];
354354
}
355355
_ => {
356356
println!("Unknown non-native platform");
@@ -368,7 +368,7 @@ impl TestRunner {
368368
out_dir,
369369
jit_supported,
370370
rust_flags,
371-
run_wrapper,
371+
run_wrapper: run_wrapper.iter().map(|s| s.to_string()).collect(),
372372
host_triple,
373373
target_triple,
374374
}
@@ -446,7 +446,7 @@ impl TestRunner {
446446

447447
// Prepend the RUN_WRAPPER's
448448
if !self.run_wrapper.is_empty() {
449-
full_cmd.push(self.run_wrapper.clone());
449+
full_cmd.extend(self.run_wrapper.iter().cloned());
450450
}
451451

452452
full_cmd.push({
@@ -459,6 +459,7 @@ impl TestRunner {
459459
full_cmd.push(arg.to_string());
460460
}
461461

462+
println!("full_CMD: {:?}", full_cmd);
462463
let mut cmd_iter = full_cmd.into_iter();
463464
let first = cmd_iter.next().unwrap();
464465

0 commit comments

Comments
 (0)