about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-03-14 15:44:37 +0100
committerGitHub <noreply@github.com>2024-03-14 15:44:37 +0100
commit02b1a91ee8fe485ab3b77100d4252094fca9b7b2 (patch)
tree424d0abe4827d24236ced7596190feb5f0ac17f6
parentc0fd2db49a68f9a9fa4c43237145fe44bc7f2c4d (diff)
parentec0b459ad20cb10ad5bab36e57c6bb8a8795d024 (diff)
downloadrust-02b1a91ee8fe485ab3b77100d4252094fca9b7b2.tar.gz
rust-02b1a91ee8fe485ab3b77100d4252094fca9b7b2.zip
Rollup merge of #122490 - Amanieu:ohos-tier2-instructions, r=GuillaumeGomez
Update build instructions for OpenHarmony

The platform page now recommends using rustup since the target is now tier 2.
-rw-r--r--src/doc/rustc/src/platform-support/openharmony.md51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/doc/rustc/src/platform-support/openharmony.md b/src/doc/rustc/src/platform-support/openharmony.md
index 9f90e741326..b2ddbfdfa29 100644
--- a/src/doc/rustc/src/platform-support/openharmony.md
+++ b/src/doc/rustc/src/platform-support/openharmony.md
@@ -96,9 +96,34 @@ exec /path/to/ohos-sdk/linux/native/llvm/bin/clang++ \
 
 Future versions of the OpenHarmony SDK will avoid the need for this process.
 
-## Building the target
+## Building Rust programs
+
+Rustup ships pre-compiled artifacts for this target, which you can install with:
+```sh
+rustup target add aarch64-unknown-linux-ohos
+rustup target add armv7-unknown-linux-ohos
+rustup target add x86_64-unknown-linux-ohos
+```
+
+You will need to configure the linker to use in `~/.cargo/config.toml`:
+```toml
+[target.aarch64-unknown-linux-ohos]
+ar = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ar"
+linker = "/path/to/aarch64-unknown-linux-ohos-clang.sh"
+
+[target.armv7-unknown-linux-ohos]
+ar = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ar"
+linker = "/path/to/armv7-unknown-linux-ohos-clang.sh"
+
+[target.x86_64-unknown-linux-ohos]
+ar = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ar"
+linker = "/path/to/x86_64-unknown-linux-ohos-clang.sh"
+```
 
-To build a rust toolchain, create a `config.toml` with the following contents:
+## Building the target from source
+
+Instead of using `rustup`, you can instead build a rust toolchain from source.
+Create a `config.toml` with the following contents:
 
 ```toml
 profile = "compiler"
@@ -130,28 +155,6 @@ ranlib = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ranlib"
 linker  = "/path/to/x86_64-unknown-linux-ohos-clang.sh"
 ```
 
-## Building Rust programs
-
-Rust does not yet ship pre-compiled artifacts for this target. To compile for
-this target, you will either need to build Rust with the target enabled (see
-"Building the target" above), or build your own copy of `core` by using
-`build-std` or similar.
-
-You will need to configure the linker to use in `~/.cargo/config`:
-```toml
-[target.aarch64-unknown-linux-ohos]
-ar = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ar"
-linker = "/path/to/aarch64-unknown-linux-ohos-clang.sh"
-
-[target.armv7-unknown-linux-ohos]
-ar = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ar"
-linker = "/path/to/armv7-unknown-linux-ohos-clang.sh"
-
-[target.x86_64-unknown-linux-ohos]
-ar = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ar"
-linker = "/path/to/x86_64-unknown-linux-ohos-clang.sh"
-```
-
 ## Testing
 
 Running the Rust testsuite is possible, but currently difficult due to the way