Skip to content

Commit cf76fac

Browse files
yomaytkbongjunj
authored andcommitted
Fix the bug of QEMU command in the cross-compilation. (bytecodealliance#11418)
* Use QEMU_LD_PREFIX to specify the sysroot path in the cross-compilation documentation * Add CARGO_TARGET_*_RUNNER setting to the qemu command in the cross compilation documentation. * Fix cargo_test_runner to use CARGO_TARGET_ARCH in the cross compilation. * Remove extra runner settings. * Fix to use unwrap_or instead of unwrap_or_else. * Fix CI to detect the appropriate runner. * Fix documentation. * Fix the document in the cross compilation to set _RUNNER and _LINKER environment variables.
1 parent f7aad0e commit cf76fac

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

docs/contributing-cross-compiling.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,27 @@ The final bit to get out of the way is to configure `cargo` to use the
5656
appropriate `gcc` and `qemu` when cross-compiling and running tests for other
5757
architectures.
5858

59-
Add this to `.cargo/config.toml` in the Wasmtime repository (or create that file
60-
if none already exists).
59+
You will need to set `CARGO_TARGET_<triple>_RUNNER` and `CARGO_TARGET_<triple>_LINKER` for the target.
6160

62-
```toml
63-
[target.aarch64-unknown-linux-gnu]
64-
linker = "aarch64-linux-gnu-gcc"
65-
runner = "qemu-aarch64 -L /usr/aarch64-linux-gnu -E LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib -E WASMTIME_TEST_NO_HOG_MEMORY=1"
61+
* aarch64:
6662

67-
[target.riscv64gc-unknown-linux-gnu]
68-
linker = "riscv64-linux-gnu-gcc"
69-
runner = "qemu-riscv64 -L /usr/riscv64-linux-gnu -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib -E WASMTIME_TEST_NO_HOG_MEMORY=1"
63+
```console
64+
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER='qemu-aarch64 -L /usr/aarch64-linux-gnu -E LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib -E WASMTIME_TEST_NO_HOG_MEMORY=1'
65+
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER='aarch64-linux-gnu-gcc'
66+
```
67+
68+
* riscv64:
69+
70+
```console
71+
export CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_RUNNER='qemu-riscv64 -L /usr/riscv64-linux-gnu -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib -E WASMTIME_TEST_NO_HOG_MEMORY=1'
72+
export CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER='riscv64-linux-gnu-gcc'
73+
```
7074

71-
[target.s390x-unknown-linux-gnu]
72-
linker = "s390x-linux-gnu-gcc"
73-
runner = "qemu-s390x -L /usr/s390x-linux-gnu -E LD_LIBRARY_PATH=/usr/s390x-linux-gnu/lib -E WASMTIME_TEST_NO_HOG_MEMORY=1"
75+
* s390x:
76+
77+
```console
78+
export CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER='qemu-s390x -L /usr/s390x-linux-gnu -E LD_LIBRARY_PATH=/usr/s390x-linux-gnu/lib -E WASMTIME_TEST_NO_HOG_MEMORY=1'
79+
export CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER='s390x-linux-gnu-gcc'
7480
```
7581

7682
## Cross-Compile Tests and Run Them!

0 commit comments

Comments
 (0)