Skip to content

Commit 70aaf98

Browse files
authored
Rollup merge of rust-lang#125669 - ferrocene:hoverbear/ci-docker-riscv64gc-update, r=Kobzol
CI: Update riscv64gc-linux job to Ubuntu 22.04, rename to riscv64gc-gnu Together with [email protected], we've been starting to explore improving the state of the `riscv64gc-unknown-linux-gnu` target. Additionally, I'm looking to add support for this platform in [Ferrocene](https://github.com/ferrocene/ferrocene) ([Related PR](ferrocene/ferrocene#618)). There currently exists a `src/ci/docker/host-x86_64/disabled/riscv64gc-linux` job for the CI, however it is currently experiencing errors. <details> <summary>Errors</summary> ```bash $ DEPLOY=1 ./src/ci/docker/run.sh riscv64gc-linux # ... [RUSTC-TIMING] addr2line test:false 0.371 [RUSTC-TIMING] gimli test:false 3.159 [RUSTC-TIMING] object test:false 4.249 error: linking with `riscv64-linux-gnu-gcc` failed: exit status: 1 | = note: LC_ALL="C" PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/bin:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/bin:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "riscv64-linux-gnu-gcc" "-Wl,--version-script=/tmp/rustcQaIpWi/list" "-Wl,--no-undefined-version" "/tmp/rustcQaIpWi/symbols.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/std-ff89a9732cd5d858.std.1b5d59225ff40bd2-cgu.0.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/std-ff89a9732cd5d858.dalhl7sfna1ffn4nhy6pyfa7f.rcgu.rmeta" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/std-ff89a9732cd5d858.ef0znsdf1ihn2bjkmclodhclp.rcgu.o" "-Wl,--as-needed" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/release/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/build/compiler_builtins-9e9a40064e2f2bd3/out" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/riscv64gc-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libpanic_unwind-d968371aba64a26c.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libobject-da5b6473912e89d6.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libmemchr-9cfa08d2baa3643e.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libaddr2line-06e0d2153cecb6ce.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libgimli-6fdf5551cec83840.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/librustc_demangle-8ada6466f763fa2e.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libstd_detect-edc0d12d029c4c86.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libhashbrown-9c782935934c8c14.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/librustc_std_workspace_alloc-b6984e43b381efa4.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libminiz_oxide-37ee29bf49ccaa96.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libadler-591133f6804fa0f4.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libunwind-94d98075f42175f3.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libcfg_if-e267a7b9dd7af3a7.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/liblibc-503571a038f8d9fd.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/liballoc-e36c72a5cf0ee45f.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/librustc_std_workspace_core-076c2b8501e25f03.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libcore-c446fff80486d0bb.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libcompiler_builtins-26dc6b5e31e1fdb9.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/riscv64gc-unknown-linux-gnu/lib" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libstd-ff89a9732cd5d858.so" "-shared" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-Wl,-z,origin" "-Wl,-rpath,$ORIGIN/../lib" # ... /usr/lib/gcc-cross/riscv64-linux-gnu/9/../../../../riscv64-linux-gnu/bin/ld: failed to merge target specific data of file /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libcompiler_builtins-26dc6b5e31e1fdb9.rlib(compiler_builtins-26dc6b5e31e1fdb9.compiler_builtins.74504a151a6bdbbf-cgu.124.rcgu.o) /usr/lib/gcc-cross/riscv64-linux-gnu/9/../../../../riscv64-linux-gnu/bin/ld: -march=rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0: unsupported ISA subset `z' /usr/lib/gcc-cross/riscv64-linux-gnu/9/../../../../riscv64-linux-gnu/bin/ld: failed to merge target specific data of file /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/riscv64gc-unknown-linux-gnu/release/deps/libcompiler_builtins-26dc6b5e31e1fdb9.rlib(compiler_builtins-26dc6b5e31e1fdb9.compiler_builtins.74504a151a6bdbbf-cgu.004.rcgu.o) collect2: error: ld returned 1 exit status [RUSTC-TIMING] std test:false 15.138 error: could not compile `std` (lib) due to 1 previous error Building bootstrap Build completed unsuccessfully in 0:04:41 local time: Tue May 28 16:25:09 UTC 2024 network time: Tue, 28 May 2024 16:25:17 GMT ``` </details> This PR fixes the breakage enough to get the tests running. It does so through bringing the `riscv64gc-unknown-linux-gnu` related test job in line with other related jobs, adopting many of the recent changes present in `src/ci/docker/host-x86_64/armhf-gnu` such as: * Using Ubuntu 22.04 * Installing a more narrowly scoped package set * Using `curl` instead of `debootstrap` to set up the root * No longer patching `busybox` * Removing the `cmake.sh` script related steps ## Justifying Renaming `riscv64gc-linux` to `riscv64gc-gnu` The `src/ci/docker/host-x86_64/disabled/riscv64gc-linux` job runs the tests for `risv64gc-unknown-linux-gnu`, it is based off `src/ci/docker/host-x86_64/armhf-gnu`. There are other jobs that follow a `$arch-gnu` naming scheme: * `src/ci/docker/host-x86_64/armhf-gnu` * `src/ci/docker/host-x86_64/x86_64-gnu` * `src/ci/docker/host-aarch64/aarch64-gnu` It follows that the name `src/ci/docker/host-x86_64/disabled/riscv64gc-linux` should be `src/ci/docker/host-x86_64/disabled/riscv64gc-gnu`, like the others. ## Testing > [!NOTE] > `riscv64gc-unknown-linux-gnu` is a [**Tier 2 with Host Tools** platform](https://doc.rust-lang.org/beta/rustc/platform-support.html), all tests may not necessarily pass! There is work in rust-lang#125220 which helps fix several related tests. You can test out the renamed job: ```sh DEPLOY=1 ./src/ci/docker/run.sh riscv64gc-gnu ``` `DEPLOY=1` helps reproduce the CI's environment and also avoids the chance of a `llvm-c/BitReader.h` error (detailed in rust-lang#85424 and rust-lang#56650). <details> <summary>Sample of output (expected test failure)</summary> ```bash $ DEPLOY=1 ./src/ci/docker/run.sh riscv64gc-gnu # ... test [ui] tests/ui/where-clauses/where-clause-method-substituion-rpass.rs ... ok failures: ---- [ui] tests/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs stdout ---- error: test compilation failed although it shouldn't! status: exit status: 1 command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=riscv64gc-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo" "-A" "unused" "-A" "internal_features" "-Crpath" "-Lnative=/checkout/obj/build/riscv64gc-unknown-linux-gnu/native/rust-test-helpers" "-Clinker=riscv64-linux-gnu-gcc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo/auxiliary" "-g" "--emit=llvm-ir" "-Csplit-debuginfo=unpacked" stdout: none --- stderr ------------------------------- error: `-Csplit-debuginfo=unpacked` is unstable on this platform error: aborting due to 1 previous error ------------------------------------------ failures: [ui] tests/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs test result: FAILED. 5 passed; 1 failed; 16897 ignored; 0 measured; 0 filtered out; finished in 410.99ms Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=riscv64gc-unknown-linux-gnu local time: Tue May 28 16:28:22 UTC 2024 network time: Tue, 28 May 2024 16:28:30 GMT ``` </details> try-job: riscv64gc-gnu
2 parents 999ac87 + e1b489d commit 70aaf98

File tree

3 files changed

+42
-148
lines changed

3 files changed

+42
-148
lines changed

src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile src/ci/docker/host-x86_64/disabled/riscv64gc-gnu/Dockerfile

+42-52
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,36 @@
11
# based on armhf-gnu/Dockerfile
2-
FROM ubuntu:20.04
2+
FROM ubuntu:22.04
33

4-
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
4+
ARG DEBIAN_FRONTEND=noninteractive
55
RUN apt-get update -y && apt-get install -y --no-install-recommends \
6-
bc \
7-
bison \
8-
ca-certificates \
9-
cmake \
10-
cpio \
11-
curl \
12-
debian-ports-archive-keyring \
13-
debootstrap \
14-
flex \
15-
gcc \
16-
gcc-riscv64-linux-gnu \
17-
git \
18-
g++-riscv64-linux-gnu \
19-
g++ \
20-
libc6-dev \
21-
libc6-dev-riscv64-cross \
22-
libssl-dev \
23-
make \
24-
ninja-build \
25-
patch \
26-
python3 \
27-
qemu-system-misc \
28-
xz-utils
6+
bc \
7+
bzip2 \
8+
ca-certificates \
9+
cmake \
10+
cpio \
11+
curl \
12+
file \
13+
flex \
14+
bison \
15+
g++ \
16+
g++-riscv64-linux-gnu \
17+
git \
18+
libc6-dev \
19+
libc6-dev-riscv64-cross \
20+
libssl-dev \
21+
make \
22+
ninja-build \
23+
python3 \
24+
qemu-system-riscv64 \
25+
xz-utils
2926

30-
ENV ARCH=riscv
31-
ENV CROSS_COMPILE=riscv64-linux-gnu-
27+
ENV ARCH=riscv \
28+
CROSS_COMPILE=riscv64-linux-gnu-
3229

3330
WORKDIR /build
3431

3532
# From https://github.com/michaeljclark/busybear-linux/blob/master/conf/linux.config
36-
COPY host-x86_64/riscv64gc-linux/linux.config /build
33+
COPY host-x86_64/riscv64gc-gnu/linux.config /build
3734

3835
# Compile the kernel that we're going to be emulating with. This is
3936
# basically just done to be compatible with the QEMU target that we're going
@@ -49,29 +46,22 @@ RUN curl https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.16.tar.xz | tar
4946
# Compile an instance of busybox as this provides a lightweight system and init
5047
# binary which we will boot into. Only trick here is configuring busybox to
5148
# build static binaries.
52-
RUN curl https://busybox.net/downloads/busybox-1.31.1.tar.bz2 | tar xjf -
53-
COPY host-x86_64/riscv64gc-linux/0001-Remove-stime-function-calls.patch /build/busybox-1.31.1/
54-
RUN cd /build/busybox-1.31.1 && \
55-
patch -p1 -i 0001-Remove-stime-function-calls.patch && \
56-
make defconfig && \
57-
sed -i 's/.*CONFIG_STATIC.*/CONFIG_STATIC=y/' .config && \
58-
make -j$(nproc) && \
59-
make install && \
60-
mv _install /tmp/rootfs && \
61-
cd /build && \
62-
rm -rf busybox-1.31.1
49+
RUN curl https://www.busybox.net/downloads/busybox-1.32.1.tar.bz2 | tar xjf - && \
50+
cd busybox-1.32.1 && \
51+
make defconfig && \
52+
sed -i 's/.*CONFIG_STATIC.*/CONFIG_STATIC=y/' .config && \
53+
make -j$(nproc) && \
54+
make install && \
55+
mv _install /tmp/rootfs && \
56+
cd /build && \
57+
rm -rf busybox-1.32.1
6358

64-
# Download the ubuntu rootfs, which we'll use as a chroot for all our tests
65-
# This is only needed to provide /lib/* and /usr/lib/*
59+
# Download the ubuntu rootfs, which we'll use as a chroot for all our tests.
6660
WORKDIR /tmp
67-
RUN debootstrap --variant=minbase --arch=riscv64 --foreign focal /tmp/rootfs/ubuntu
68-
RUN cd rootfs && mkdir proc sys dev etc etc/init.d
69-
# rootfs/ubuntu/proc is in a weird state (access fails with ELOOP) until
70-
# rootfs/ubuntu/debootstrap/debootstrap --second-stage is run (under emulation),
71-
# but this takes ages. Instead hack it into a good enough state.
72-
# /proc is used by std::env::current_exe() (which is roughly
73-
# `readlink /proc/self/exe`)
74-
RUN cd rootfs/ubuntu && rm -rf proc && mkdir proc
61+
RUN mkdir rootfs/ubuntu
62+
RUN curl https://cdimage.ubuntu.com/ubuntu-base/releases/22.04/release/ubuntu-base-22.04.2-base-riscv64.tar.gz | \
63+
tar xzf - -C rootfs/ubuntu && \
64+
cd rootfs && mkdir proc sys dev etc etc/init.d
7565

7666
# Copy over our init script, which starts up our test server and also a few other
7767
# misc tasks
@@ -95,12 +85,12 @@ RUN mkdir build && cd build && \
9585
WORKDIR /tmp
9686
RUN rm -rf /tmp/riscv-pk
9787

98-
COPY scripts/cmake.sh /scripts/
99-
RUN /scripts/cmake.sh
100-
10188
COPY scripts/sccache.sh /scripts/
10289
RUN sh /scripts/sccache.sh
10390

91+
# Avoid "fatal: detected dubious ownership in repository at '/checkout'" error
92+
RUN git config --global --add safe.directory /checkout
93+
10494
ENV RUST_CONFIGURE_ARGS --qemu-riscv64-rootfs=/tmp/rootfs
10595
ENV SCRIPT python3 ../x.py --stage 2 test --host='' --target riscv64gc-unknown-linux-gnu
10696

src/ci/docker/host-x86_64/disabled/riscv64gc-linux/0001-Remove-stime-function-calls.patch

-96
This file was deleted.

0 commit comments

Comments
 (0)