Skip to content

Commit 227690a

Browse files
committed
Auto merge of #137011 - LuuuXXX:promote-ohos-with-host-tools, r=Amanieu
Promote ohos targets to tier2 with host tools. ### What does this PR try to resolve? Try to promote the following [[Tier 2 without Host Tools](https://doc.rust-lang.org/rustc/platform-support.html#tier-2-without-host-tools)](https://doc.rust-lang.org/rustc/platform-support.html#tier-2-without-host-tools) targets to [[Tier 2 with Host Tools](https://doc.rust-lang.org/rustc/platform-support.html#tier-2-with-host-tools)](https://doc.rust-lang.org/rustc/platform-support.html#tier-2-with-host-tools): - `aarch64-unknown-linux-ohos` - `armv7-unknown-linux-ohos` - `x86_64-unknown-linux-ohos` ### More Information? see MCP: rust-lang/compiler-team#811 ### Blockage to be solved? - [x] Submit an MCP - [x] Submit code of promote ohos targets - [x] Resolve related dependencies (`measureme`) The modified code of the measureme has been merged (see rust-lang/measureme#238). [done] The new version will was released (rust-lang/measureme#240). [done]
2 parents 8b87fef + 4cd350f commit 227690a

File tree

13 files changed

+88
-22
lines changed

13 files changed

+88
-22
lines changed

Cargo.lock

+18-5
Original file line numberDiff line numberDiff line change
@@ -2188,6 +2188,20 @@ dependencies = [
21882188
"smallvec",
21892189
]
21902190

2191+
[[package]]
2192+
name = "measureme"
2193+
version = "12.0.1"
2194+
source = "registry+https://github.com/rust-lang/crates.io-index"
2195+
checksum = "570a507d8948a66a97f42cbbaf8a6bb9516a51017d4ee949502ad7a10a864395"
2196+
dependencies = [
2197+
"log",
2198+
"memmap2",
2199+
"parking_lot",
2200+
"perf-event-open-sys",
2201+
"rustc-hash 1.1.0",
2202+
"smallvec",
2203+
]
2204+
21912205
[[package]]
21922206
name = "memchr"
21932207
version = "2.7.4"
@@ -2271,7 +2285,7 @@ dependencies = [
22712285
"libc",
22722286
"libffi",
22732287
"libloading",
2274-
"measureme",
2288+
"measureme 11.0.1",
22752289
"rand 0.9.0",
22762290
"regex",
22772291
"rustc_version",
@@ -3361,7 +3375,7 @@ dependencies = [
33613375
"gimli 0.30.0",
33623376
"itertools",
33633377
"libc",
3364-
"measureme",
3378+
"measureme 12.0.1",
33653379
"object 0.36.7",
33663380
"rustc-demangle",
33673381
"rustc_abi",
@@ -3478,7 +3492,7 @@ dependencies = [
34783492
"indexmap",
34793493
"jobserver",
34803494
"libc",
3481-
"measureme",
3495+
"measureme 12.0.1",
34823496
"memmap2",
34833497
"parking_lot",
34843498
"portable-atomic",
@@ -4240,8 +4254,7 @@ dependencies = [
42404254
name = "rustc_query_impl"
42414255
version = "0.0.0"
42424256
dependencies = [
4243-
"measureme",
4244-
"rustc_attr_data_structures",
4257+
"measureme 12.0.1",
42454258
"rustc_data_structures",
42464259
"rustc_errors",
42474260
"rustc_hashes",

compiler/rustc_codegen_llvm/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ bitflags = "2.4.1"
1414
gimli = "0.30"
1515
itertools = "0.12"
1616
libc = "0.2"
17-
measureme = "11"
17+
measureme = "12.0.1"
1818
object = { version = "0.36.3", default-features = false, features = ["std", "read"] }
1919
rustc-demangle = "0.1.21"
2020
rustc_abi = { path = "../rustc_abi" }

compiler/rustc_data_structures/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ elsa = "1.11.0"
1212
ena = "0.14.3"
1313
indexmap = "2.4.0"
1414
jobserver_crate = { version = "0.1.28", package = "jobserver" }
15-
measureme = "11"
15+
measureme = "12.0.1"
1616
rustc-hash = "2.0.0"
1717
rustc-rayon = { version = "0.5.1", features = ["indexmap"] }
1818
rustc-stable-hash = { version = "0.1.0", features = ["nightly"] }

compiler/rustc_llvm/build.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ fn main() {
241241
println!("cargo:rustc-link-lib=kstat");
242242
}
243243

244-
if (target.starts_with("arm") && !target.contains("freebsd"))
244+
if (target.starts_with("arm") && !target.contains("freebsd")) && !target.contains("ohos")
245245
|| target.starts_with("mips-")
246246
|| target.starts_with("mipsel-")
247247
|| target.starts_with("powerpc-")
@@ -371,6 +371,7 @@ fn main() {
371371
|| target.contains("freebsd")
372372
|| target.contains("windows-gnullvm")
373373
|| target.contains("aix")
374+
|| target.contains("ohos")
374375
{
375376
"c++"
376377
} else if target.contains("netbsd") && llvm_static_stdcpp.is_some() {

compiler/rustc_query_impl/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ edition = "2024"
55

66
[dependencies]
77
# tidy-alphabetical-start
8-
measureme = "11"
9-
rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
8+
measureme = "12.0.1"
109
rustc_data_structures = { path = "../rustc_data_structures" }
1110
rustc_errors = { path = "../rustc_errors" }
1211
rustc_hashes = { path = "../rustc_hashes" }

src/bootstrap/src/core/build_steps/llvm.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,10 @@ impl Step for Llvm {
471471
cfg.define("LLVM_BUILD_32_BITS", "ON");
472472
}
473473

474+
if target.starts_with("x86_64") && target.contains("ohos") {
475+
cfg.define("LLVM_TOOL_LLVM_RTDYLD_BUILD", "OFF");
476+
}
477+
474478
let mut enabled_llvm_projects = Vec::new();
475479

476480
if helpers::forcing_clang_based_tests() {
@@ -769,7 +773,9 @@ fn configure_cmake(
769773
cflags.push(" ");
770774
cflags.push(s);
771775
}
772-
776+
if target.contains("ohos") {
777+
cflags.push(" -D_LINUX_SYSINFO_H");
778+
}
773779
if builder.config.llvm_clang_cl.is_some() {
774780
cflags.push(format!(" --target={target}"));
775781
}
@@ -790,6 +796,9 @@ fn configure_cmake(
790796
cxxflags.push(" ");
791797
cxxflags.push(s);
792798
}
799+
if target.contains("ohos") {
800+
cxxflags.push(" -D_LINUX_SYSINFO_H");
801+
}
793802
if builder.config.llvm_clang_cl.is_some() {
794803
cxxflags.push(format!(" --target={target}"));
795804
}
@@ -1176,6 +1185,10 @@ impl Step for Sanitizers {
11761185
cfg.define("COMPILER_RT_USE_LIBCXX", "OFF");
11771186
cfg.define("LLVM_CONFIG_PATH", &llvm_config);
11781187

1188+
if self.target.contains("ohos") {
1189+
cfg.define("COMPILER_RT_USE_BUILTINS_LIBRARY", "ON");
1190+
}
1191+
11791192
// On Darwin targets the sanitizer runtimes are build as universal binaries.
11801193
// Unfortunately sccache currently lacks support to build them successfully.
11811194
// Disable compiler launcher on Darwin targets to avoid potential issues.

src/ci/docker/host-x86_64/dist-ohos/Dockerfile

+16-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2222
COPY scripts/ohos-sdk.sh /scripts/
2323
RUN sh /scripts/ohos-sdk.sh
2424

25+
COPY scripts/ohos-openssl.sh /scripts/
26+
RUN sh /scripts/ohos-openssl.sh
27+
2528
COPY scripts/ohos/aarch64-unknown-linux-ohos-clang.sh /usr/local/bin/
2629
COPY scripts/ohos/aarch64-unknown-linux-ohos-clang++.sh /usr/local/bin/
2730
COPY scripts/ohos/armv7-unknown-linux-ohos-clang.sh /usr/local/bin/
@@ -30,6 +33,14 @@ COPY scripts/ohos/x86_64-unknown-linux-ohos-clang.sh /usr/local/bin/
3033
COPY scripts/ohos/x86_64-unknown-linux-ohos-clang++.sh /usr/local/bin/
3134

3235
# env
36+
ENV AARCH64_UNKNOWN_LINUX_OHOS_OPENSSL_DIR=/opt/ohos-openssl/prelude/arm64-v8a
37+
ENV ARMV7_UNKNOWN_LINUX_OHOS_OPENSSL_DIR=/opt/ohos-openssl/prelude/armeabi-v7a
38+
ENV X86_64_UNKNOWN_LINUX_OHOS_OPENSSL_DIR=/opt/ohos-openssl/prelude/x86_64
39+
40+
ENV AARCH64_UNKNOWN_LINUX_OHOS_OPENSSL_NO_VENDOR=1
41+
ENV ARMV7_UNKNOWN_LINUX_OHOS_OPENSSL_NO_VENDOR=1
42+
ENV X86_64_UNKNOWN_LINUX_OHOS_OPENSSL_NO_VENDOR=1
43+
3344
ENV TARGETS=aarch64-unknown-linux-ohos
3445
ENV TARGETS=$TARGETS,armv7-unknown-linux-ohos
3546
ENV TARGETS=$TARGETS,x86_64-unknown-linux-ohos
@@ -49,9 +60,12 @@ ENV \
4960

5061
ENV RUST_CONFIGURE_ARGS \
5162
--enable-profiler \
52-
--disable-docs
63+
--disable-docs \
64+
--tools=cargo,clippy,rustdocs,rustfmt,rust-analyzer,rust-analyzer-proc-macro-srv,analysis,src,wasm-component-ld \
65+
--enable-extended \
66+
--enable-sanitizers
5367

54-
ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS
68+
ENV SCRIPT python3 ../x.py dist --host=$TARGETS --target $TARGETS
5569

5670
COPY scripts/sccache.sh /scripts/
5771
RUN sh /scripts/sccache.sh

src/ci/docker/scripts/ohos-openssl.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
set -ex
3+
4+
URL=https://github.com/ohos-rs/ohos-openssl/archive/refs/tags/0.1.0.tar.gz
5+
6+
mkdir -p /opt/ohos-openssl
7+
curl -fL $URL | tar xz -C /opt/ohos-openssl --strip-components=1

src/ci/docker/scripts/ohos-sdk.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/sh
22
set -ex
33

4-
URL=https://repo.huaweicloud.com/openharmony/os/4.0-Release/ohos-sdk-windows_linux-public.tar.gz
4+
URL=https://repo.huaweicloud.com/openharmony/os/5.0.0-Release/ohos-sdk-windows_linux-public.tar.gz
55

6-
curl $URL | tar xz -C /tmp ohos-sdk/linux/native-linux-x64-4.0.10.13-Release.zip
6+
curl $URL | tar xz -C /tmp linux/native-linux-x64-5.0.0.71-Release.zip
77
mkdir /opt/ohos-sdk
88
cd /opt/ohos-sdk
9-
unzip -qq /tmp/ohos-sdk/linux/native-linux-x64-4.0.10.13-Release.zip
9+
unzip -qq /tmp/linux/native-linux-x64-5.0.0.71-Release.zip
10+
rm /tmp/linux/native-linux-x64-5.0.0.71-Release.zip

src/ci/github-actions/jobs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ auto:
176176
<<: *job-linux-4c
177177

178178
- name: dist-ohos
179-
<<: *job-linux-4c
179+
<<: *job-linux-4c-largedisk
180180

181181
- name: dist-powerpc-linux
182182
<<: *job-linux-4c

src/ci/run.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ export RUST_RELEASE_CHANNEL=$(releaseChannel)
112112
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL"
113113

114114
if [ "$DEPLOY$DEPLOY_ALT" = "1" ]; then
115-
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
115+
if [[ "$CI_JOB_NAME" == *ohos* ]]; then
116+
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-static-stdcpp"
117+
else
118+
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
119+
fi
116120
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.remap-debuginfo"
117121

118122
if [ "$DEPLOY_ALT" != "" ] && isLinux; then

src/doc/rustc/src/platform-support.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ target | notes
8989
-------|-------
9090
`aarch64-pc-windows-msvc` | ARM64 Windows MSVC
9191
`aarch64-unknown-linux-musl` | ARM64 Linux with musl 1.2.3
92+
[`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | ARM64 OpenHarmony
9293
`arm-unknown-linux-gnueabi` | Armv6 Linux (kernel 3.2, glibc 2.17)
9394
`arm-unknown-linux-gnueabihf` | Armv6 Linux, hardfloat (kernel 3.2, glibc 2.17)
9495
`armv7-unknown-linux-gnueabihf` | Armv7-A Linux, hardfloat (kernel 3.2, glibc 2.17)
96+
[`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | Armv7-A OpenHarmony
9597
[`loongarch64-unknown-linux-gnu`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19, glibc 2.36)
9698
[`loongarch64-unknown-linux-musl`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19, musl 1.2.5)
9799
`powerpc-unknown-linux-gnu` | PowerPC Linux (kernel 3.2, glibc 2.17)
@@ -104,6 +106,7 @@ target | notes
104106
[`x86_64-unknown-freebsd`](platform-support/freebsd.md) | 64-bit x86 FreeBSD
105107
[`x86_64-unknown-illumos`](platform-support/illumos.md) | illumos
106108
`x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.3
109+
[`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | x86_64 OpenHarmony
107110
[`x86_64-unknown-netbsd`](platform-support/netbsd.md) | NetBSD/amd64
108111

109112
## Tier 2 without Host Tools
@@ -142,7 +145,6 @@ target | std | notes
142145
[`aarch64-linux-android`](platform-support/android.md) | ✓ | ARM64 Android
143146
[`aarch64-pc-windows-gnullvm`](platform-support/pc-windows-gnullvm.md) | ✓ | ARM64 MinGW (Windows 10+), LLVM ABI
144147
[`aarch64-unknown-fuchsia`](platform-support/fuchsia.md) | ✓ | ARM64 Fuchsia
145-
[`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | ARM64 OpenHarmony
146148
`aarch64-unknown-none` | * | Bare ARM64, hardfloat
147149
`aarch64-unknown-none-softfloat` | * | Bare ARM64, softfloat
148150
[`aarch64-unknown-uefi`](platform-support/unknown-uefi.md) | ? | ARM64 UEFI
@@ -158,7 +160,6 @@ target | std | notes
158160
`armv7-unknown-linux-gnueabi` | ✓ | Armv7-A Linux (kernel 4.15, glibc 2.27)
159161
`armv7-unknown-linux-musleabi` | ✓ | Armv7-A Linux with musl 1.2.3
160162
`armv7-unknown-linux-musleabihf` | ✓ | Armv7-A Linux with musl 1.2.3, hardfloat
161-
[`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | Armv7-A OpenHarmony
162163
[`armv7a-none-eabi`](platform-support/arm-none-eabi.md) | * | Bare Armv7-A
163164
[`armv7r-none-eabi`](platform-support/armv7r-none-eabi.md) | * | Bare Armv7-R
164165
[`armv7r-none-eabihf`](platform-support/armv7r-none-eabi.md) | * | Bare Armv7-R, hardfloat
@@ -204,7 +205,6 @@ target | std | notes
204205
[`x86_64-pc-windows-gnullvm`](platform-support/pc-windows-gnullvm.md) | ✓ | 64-bit x86 MinGW (Windows 10+), LLVM ABI
205206
[`x86_64-unknown-fuchsia`](platform-support/fuchsia.md) | ✓ | 64-bit x86 Fuchsia
206207
`x86_64-unknown-linux-gnux32` | ✓ | 64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27)
207-
[`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | x86_64 OpenHarmony
208208
[`x86_64-unknown-none`](platform-support/x86_64-unknown-none.md) | * | Freestanding/bare-metal x86_64, softfloat
209209
[`x86_64-unknown-redox`](platform-support/redox.md) | ✓ | Redox OS
210210
[`x86_64-unknown-uefi`](platform-support/unknown-uefi.md) | ? | 64-bit UEFI

src/doc/rustc/src/platform-support/openharmony.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# `*-unknown-linux-ohos`
22

3-
**Tier: 2**
3+
**Tier: 2 (with Host Tools)**
44

55
* aarch64-unknown-linux-ohos
66
* armv7-unknown-linux-ohos
@@ -18,6 +18,20 @@ system.
1818
- Amanieu d'Antras ([@Amanieu](https://github.com/Amanieu))
1919
- Lu Binglun ([@lubinglun](https://github.com/lubinglun))
2020

21+
## Requirements
22+
23+
All the ohos targets of Tier 2 with host tools support all extended rust tools.
24+
(exclude `miri`, the support of `miri` will be added soon)
25+
26+
### Host toolchain
27+
28+
The targets require a reasonably up-to-date OpenHarmony SDK on the host.
29+
30+
The targets support `cargo`, which require [ohos-openssl](https://github.com/ohos-rs/ohos-openssl).
31+
32+
`miri` isn't supported yet, since its dependencies (`libffi` and `tikv-jemalloc-sys`) don't support
33+
compiling for the OHOS targets.
34+
2135
## Setup
2236

2337
The OpenHarmony SDK doesn't currently support Rust compilation directly, so

0 commit comments

Comments
 (0)