forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#117771 - tmandry:fuchsia-gha, r=<try>
Build Fuchsia in CI This is very much in a draft state but I wanted to put it up now to get early feedback. It would also be nice if we could test it on actual CI builders. Fittingly, it is failing right now due to discovering an ICE in clippy, probably more fallout from recent type system changes. Other recent regressions this would have caught include - rust-lang#117455 and rust-lang#117493 - rust-lang#117602 This ends up not sharing very much at all with cargotest. Fuchsia has its own tool to manage checkouts and its own build system. What it requires is a fully "install"ed toolchain with a host and fuchsia target. We share logic from the dist-various-2 builder to build the fuchsia target. Right now this runs clippy and skips linking a bunch of targets, since most issues we catch are in the frontend. In theory we could probably get the build CPU time down quite a bit with this approach, but right now some linked targets are creeping into the dependencies anyway and we don't have a good way of preventing that yet. The approach is basically to get a checkout at a pinned commit and then run a [script](https://fuchsia-review.git.corp.google.com/c/fuchsia/+/943833/6/scripts/rust/build_fuchsia_from_rust_ci.sh) at a predetermined location. I would like to update that pin every few weeks. For now we cherry-pick some build changes but that's temporary. Partial checkouts are used to minimize clone time, but we don't filter out prebuilt packages. r? `@Mark-Simulacrum` Based on discussion in [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Putting.20Fuchsia.20in.20crater).
- Loading branch information
Showing
8 changed files
with
227 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
src/ci/docker/host-x86_64/x86_64-gnu-experimental/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
#gawk \ | ||
g++ \ | ||
make \ | ||
ninja-build \ | ||
file \ | ||
curl \ | ||
ca-certificates \ | ||
python3 \ | ||
git \ | ||
cmake \ | ||
libssl-dev \ | ||
sudo \ | ||
xz-utils \ | ||
pkg-config \ | ||
unzip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copied from dist-various-2 Dockerfile. | ||
# TODO move to canonical triple and deduplicate this list | ||
ENV \ | ||
AR_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-ar \ | ||
CC_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang \ | ||
CFLAGS_x86_64_unknown_fuchsia="--target=x86_64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \ | ||
CXX_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang++ \ | ||
CXXFLAGS_x86_64_unknown_fuchsia="--target=x86_64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \ | ||
LDFLAGS_x86_64_unknown_fuchsia="--target=x86_64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot -L/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/lib" \ | ||
AR_x86_64_fuchsia=x86_64-unknown-fuchsia-ar \ | ||
CC_x86_64_fuchsia=x86_64-unknown-fuchsia-clang \ | ||
CFLAGS_x86_64_fuchsia="--target=x86_64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \ | ||
CXX_x86_64_fuchsia=x86_64-unknown-fuchsia-clang++ \ | ||
CXXFLAGS_x86_64_fuchsia="--target=x86_64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \ | ||
LDFLAGS_x86_64_fuchsia="--target=x86_64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot -L/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/lib" | ||
|
||
WORKDIR /tmp | ||
COPY scripts/build-fuchsia-toolchain.sh /tmp/ | ||
RUN /tmp/build-fuchsia-toolchain.sh | ||
|
||
# TODO move to canonical triple | ||
ENV CARGO_TARGET_X86_64_FUCHSIA_AR /usr/local/bin/llvm-ar | ||
ENV CARGO_TARGET_X86_64_FUCHSIA_RUSTFLAGS \ | ||
-C link-arg=--sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot \ | ||
-Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot/lib \ | ||
-Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/lib | ||
ENV CARGO_TARGET_AARCH64_FUCHSIA_AR /usr/local/bin/llvm-ar | ||
ENV CARGO_TARGET_AARCH64_FUCHSIA_RUSTFLAGS \ | ||
-C link-arg=--sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot \ | ||
-Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot/lib \ | ||
-Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/lib | ||
|
||
#ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS -Clink-arg=-static-libstdc++ | ||
|
||
ENV TARGETS=x86_64-fuchsia | ||
ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnu | ||
|
||
COPY scripts/sccache.sh /scripts/ | ||
RUN sh /scripts/sccache.sh | ||
|
||
ENV RUST_INSTALL_DIR /checkout/obj/install | ||
RUN mkdir -p $RUST_INSTALL_DIR/etc | ||
|
||
# TODO: --stage 1? | ||
ENV RUST_CONFIGURE_ARGS --prefix=$RUST_INSTALL_DIR --sysconfdir=etc --enable-lld --llvm-libunwind=in-tree --enable-extended --disable-docs \ | ||
--set target.x86_64-fuchsia.cc=/usr/local/bin/clang \ | ||
--set target.x86_64-fuchsia.cxx=/usr/local/bin/clang++ \ | ||
--set target.x86_64-fuchsia.ar=/usr/local/bin/llvm-ar \ | ||
--set target.x86_64-fuchsia.ranlib=/usr/local/bin/llvm-ranlib \ | ||
--set target.x86_64-fuchsia.linker=/usr/local/bin/ld.lld | ||
ENV SCRIPT \ | ||
python3 ../x.py install --target $TARGETS compiler/rustc library/std clippy && \ | ||
python3 ../x.py test src/tools/cargotest | ||
|
27 changes: 22 additions & 5 deletions
27
...dist-various-2/build-fuchsia-toolchain.sh → ...docker/scripts/build-fuchsia-toolchain.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters