diff --git a/docs/Building-Dart-SDK-for-ARM-or-RISC-V.md b/docs/Building-Dart-SDK-for-ARM-or-RISC-V.md index 425a317e9a47..c7a589a9f0d6 100644 --- a/docs/Building-Dart-SDK-for-ARM-or-RISC-V.md +++ b/docs/Building-Dart-SDK-for-ARM-or-RISC-V.md @@ -1,26 +1,21 @@ -> [!IMPORTANT] -> This page was copied from https://github.com/dart-lang/sdk/wiki and needs review. -> Please [contribute](../CONTRIBUTING.md) changes to bring it up-to-date - -> removing this header - or send a CL to delete the file. - ---- - # Introduction The Dart VM runs on a variety of ARM processors on Linux and Android. This document explains how to build the Dart VM and SDK to target these platforms. # Cross-compiling -If you are building natively on the device you will be running on, you can skip this step. The build scripts download a cross-compilation toolchain using clang that supports ia32, x64, arm and arm64, so you do not need to install a cross-compiler yourself unless you want to target riscv. +The build scripts download a Clang toolchain that can target IA32, X64, ARM, ARM64 or RISCV64 and run on an X64 or ARM64 host. For these cases, you do not need to install a cross-compiler yourself. For other cases, like building on a RISCV64 host or targeting RISCV32, you will need to manually install a toolchain. ## Linux If you are running Debian/Ubuntu, you can obtain a cross-compiler by doing the following: -``` -$ sudo apt-get install g++-arm-linux-gnueabihf # For 32-bit ARM (ARMv7) -$ sudo apt-get install g++-aarch64-linux-gnu # For 64-bit ARM (ARMv8) -$ sudo apt-get install g++-riscv64-linux-gnu # For 64-bit RISC-V (RV64GC) +```bash +$ sudo apt-get install g++-i686-linux-gnu # To target ia32 +$ sudo apt-get install g++-x86-64-linux-gnu # To target x64 +$ sudo apt-get install g++-arm-linux-gnueabihf # To target arm +$ sudo apt-get install g++-aarch64-linux-gnu # To target arm64 +$ sudo apt-get install g++-riscv64-linux-gnu # To target riscv64 ``` ## Android @@ -33,21 +28,21 @@ Follow instructions under ["One-time Setup" under Android](Building-the-Dart-VM- With the default Debian/Ubuntu toolchains, simply do: -``` -$ ./tools/build.py --no-rbe --no-clang --mode release --arch arm create_sdk -$ ./tools/build.py --no-rbe --no-clang --mode release --arch arm64 create_sdk -$ ./tools/build.py --no-rbe --no-clang --mode release --arch riscv64 create_sdk +```bash +$ ./tools/build.py --no-clang --mode release --arch arm create_sdk +$ ./tools/build.py --no-clang --mode release --arch arm64 create_sdk +$ ./tools/build.py --no-clang --mode release --arch riscv64 create_sdk ``` You can also produce only a Dart VM runtime, no SDK, by replacing `create_sdk` with `runtime`. This process involves also building a VM that targets ia32/x64, which is used to generate a few parts of the SDK. You can use a different toolchain using the -t switch. For example, if the path to your gcc is /path/to/toolchain/prefix-gcc, then you'd invoke the build script with: -``` -$ ./tools/build.py --no-rbe --no-clang -m release -a arm -t arm=/path/to/toolchain/prefix create_sdk -$ ./tools/build.py --no-rbe --no-clang -m release -a arm64 -t arm64=/path/to/toolchain/prefix create_sdk -$ ./tools/build.py --no-rbe --no-clang -m release -a riscv32 -t riscv32=/path/to/toolchain/prefix create_sdk -$ ./tools/build.py --no-rbe --no-clang -m release -a riscv64 -t riscv64=/path/to/toolchain/prefix create_sdk +```bash +$ ./tools/build.py --no-clang -m release -a arm -t arm=/path/to/toolchain/prefix create_sdk +$ ./tools/build.py --no-clang -m release -a arm64 -t arm64=/path/to/toolchain/prefix create_sdk +$ ./tools/build.py --no-clang -m release -a riscv32 -t riscv32=/path/to/toolchain/prefix create_sdk +$ ./tools/build.py --no-clang -m release -a riscv64 -t riscv64=/path/to/toolchain/prefix create_sdk ``` ## Android @@ -60,8 +55,6 @@ $ ./tools/build.py --mode=release --arch=arm64 --os=android create_sdk $ ./tools/build.py --mode=release --arch=riscv64 --os=android create_sdk ``` -For all of these configurations, the runtime only can be built using the runtime target as above. - ## Debian Packages You can create Debian packages targeting ARM or RISC-V as follows: diff --git a/docs/Building-for-Fuchsia.md b/docs/Building-for-Fuchsia.md index df48e49c24ea..2ec27eda6ebe 100644 --- a/docs/Building-for-Fuchsia.md +++ b/docs/Building-for-Fuchsia.md @@ -2,13 +2,15 @@ Download and install the Dart source tree using the standard instructions for building Dart. -To build for Fuchsia, you must first update your `.gclient file with: +To build for Fuchsia, you must first update your `.gclient` file with: ``` "custom_vars": { "download_fuchsia_deps": True, }, ``` +and re-run `gclient sync`. + # Building ```bash diff --git a/docs/Building-the-Dart-VM-for-Android.md b/docs/Building-the-Dart-VM-for-Android.md index 140748505735..3cae102dfb09 100644 --- a/docs/Building-the-Dart-VM-for-Android.md +++ b/docs/Building-the-Dart-VM-for-Android.md @@ -1,17 +1,10 @@ -> [!IMPORTANT] -> This page was copied from https://github.com/dart-lang/sdk/wiki and needs review. -> Please [contribute](../CONTRIBUTING.md) changes to bring it up-to-date - -> removing this header - or send a CL to delete the file. - ---- - # Introduction -It is possible to build and run the standalone Dart VM for Android devices. This setup is not yet thoroughly tested, but is available for experimentation. +It is possible to build and run the standalone Dart VM for Android devices. ## Limitations -* The host (build) machine must be an x86 Linux machine. +* The host (build) machine must be an x64 Linux machine or a Mac. * The target (Android) device must be a device or emulator that supports the Android NDK. * The resulting Android Dart VM can only be run from the Android command line. * The resulting Android Dart VM only has access to dart:core APIs. It does not have access to the Android C or Java APIs. @@ -33,7 +26,7 @@ Run gclient sync to install the Android NDK and SDK. This may take 10 minutes or Once you've set up your build tree, you can build the Dart VM for Android by using the standard Dart build script with the addition of the --os android build flag: -`$ tools/build.py --no-rbe --arch=arm,arm64,ia32,x64 --os=android runtime` +`$ tools/build.py --arch=arm,arm64,ia32,x64,riscv64 --os=android runtime` # Testing the result @@ -61,7 +54,7 @@ Create a directory on the Android emulator. Copy the Dart VM executable to the Android emulator: -`$ adb push out/android/ReleaseAndroid{ARM,ARM64,IA32,X64}/dart /data/local/tmp/dart/dart` +`$ adb push out/android/ReleaseAndroid{ARM,ARM64,IA32,X64,RISCV64}/dart /data/local/tmp/dart/dart` Create a simple Dart test script: @@ -107,7 +100,3 @@ TA23701VKR device ``` Now, you can copy dart and hello.dart to the device as above. If an emulator is also running, be sure to give adb the -d switch to tell it to use the attached device instead of the emulator. Use the -s switch to give the device ID explicitly. - -# Notes - -The only effect of the `target_os` line in the Dart `.gclient` configuration file is to install the Android tools. Despite what the name `target_os` implies, the target_os line does not affect which OS is targeted. Therefore, once you've installed the Android tools you can (and should) leave the `target_os = ["android"]` line in place even when switching back and forth between building for Android and building for Linux.