[docs] Update QEMU instructions with a narrower set of packages.
This uses ~4GB less disk space, ~1GB less to download. Change-Id: Ia52232363fe216caf2f4ed2edb9889d615721b69 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488921 Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
@@ -66,29 +66,10 @@ $ ./tools/build.py --mode=release --arch=arm,arm64,riscv64 debian_package
|
||||
|
||||
# Testing
|
||||
|
||||
In addition to cross-compiling the Dart SDK, test items can also be cross-compiled. Even without the corresponding hardware, you can quickly verify if the source code modifications you made are correct. Below is a simple method for development on the RISCV64 platform for your reference.
|
||||
|
||||
Cross-compile the test items on X64 Linux to RISCV64 and perform correctness check:
|
||||
1. Follow the steps above to cross-compile the RISCV64 sdk.
|
||||
2. Cross-compile the test items by running: `./tools/build.py --mode release --arch riscv64 most run_ffi_unit_tests`.
|
||||
3. Install the necessary QEMU dependencies: `sudo apt install qemu-user qemu-user-static qemu-system`.
|
||||
4. Run the test items, e.g., `tests/lib`:
|
||||
In addition to cross-compiling the Dart SDK, tests can be run even without the corresponding hardware by using QEMU.
|
||||
|
||||
```bash
|
||||
export QEMU_LD_PREFIX=/usr/riscv64-linux-gnu
|
||||
|
||||
./tools/test.py \
|
||||
--runtime vm \
|
||||
--progress color \
|
||||
--arch riscv64 \
|
||||
--mode release \
|
||||
--time \
|
||||
--tasks 8 \
|
||||
lib
|
||||
```
|
||||
|
||||
If you have configured QEMU for RISCV64, you can merge steps 3 and 4 into a single command (omitting some print parameters):
|
||||
|
||||
```bash
|
||||
./tools/test.py -r vm -m release -a riscv64 --use-qemu lib
|
||||
$ sudo apt install qemu-user libc6-armhf-cross libc6-arm64-cross libc6-riscv64-cross
|
||||
$ ./tools/build.py --mode release --arch arm,arm64,riscv64 runtime
|
||||
$ ./tools/test.py --mode release --arch arm,arm64,riscv64 --use-qemu lib
|
||||
```
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
The Dart VM implements simulators for ARM and RISC-V, allowing developers with X64 machines to test compiler changes against all 6 supported architectures locally. However, these simulators only handle compiled Dart code, with the runtime still running on X64. This means compiled Dart code and any foreign libraries are in mismatched architectures, which is not supported by Dart's FFI. To test FFI we need the runtime and foreign libraries to also be in ARM/RISC-V. This can still be tested on an X64 machine by cross compiling and running under QEMU.
|
||||
|
||||
```
|
||||
$ sudo apt install qemu-user g++-aarch64-linux-gnu
|
||||
$ sudo apt install qemu-user libc6-arm64-cross
|
||||
$ tools/build.py --arch arm64 runtime runtime_precompiled
|
||||
$ QEMU_LD_PREFIX=/usr/aarch64-linux-gnu/ qemu-aarch64 out/DebugXARM64/dartvm hello.dart.dill
|
||||
Hello, world!
|
||||
@@ -12,7 +12,7 @@ Hello, world!
|
||||
## Debugging with GDB
|
||||
|
||||
```
|
||||
$ sudo apt install qemu-user g++-aarch64-linux-gnu gdb-multiarch
|
||||
$ sudo apt install qemu-user libc6-arm64-cross gdb-multiarch
|
||||
$ QEMU_LD_PREFIX=/usr/aarch64-linux-gnu/ qemu-aarch64 -g 9090 out/DebugXARM64/dartvm hello.dart.dill
|
||||
|
||||
$ gdb-multiarch
|
||||
@@ -24,7 +24,7 @@ $ gdb-multiarch
|
||||
## Running the FFI tests
|
||||
|
||||
```
|
||||
$ sudo apt install qemu-user g++-arm-linux-gnueabihf g++-aarch64-linux-gnu g++-riscv64-linux-gnu
|
||||
$ sudo apt install qemu-user libc6-armhf-cross libc6-arm64-cross libc6-riscv64-cross
|
||||
$ ./tools/build.py --arch simarm_x64 gen_snapshot
|
||||
$ ./tools/build.py --arch arm,arm64,riscv64,simarm64_arm64 runtime runtime_precompiled
|
||||
$ ./tools/test.py --arch arm,arm64,riscv64,simarm64_arm64 --use-qemu --compiler dartk,dartkp --gen-snapshot-format elf --timeout 500 ffi
|
||||
@@ -38,6 +38,6 @@ The `QEMU_LD_PREFIX` environment variable is preferable to the `-L` command line
|
||||
|
||||
Use `Ctrl+A` to get to the QEMU monitor if the process isn't responding to `Ctrl+C`.
|
||||
|
||||
The `qemu-user` package doesn't provide the libc, etc for the guest architectures. The `g++` cross-compilation packages transitively include the packages that do.
|
||||
The `qemu-user` package doesn't provide the libc, etc for the guest architectures. The `libc6-<arch>-cross` packages do.
|
||||
|
||||
The Clang downloaded by `gclient sync` doesn't support 32-bit RISC-V, and Debian/Ubuntu don't provide a `g++-riscv32-linux-gnu` package.
|
||||
The Clang downloaded by `gclient sync` doesn't support 32-bit RISC-V, and Debian/Ubuntu don't provide riscv32 packages.
|
||||
|
||||
Reference in New Issue
Block a user