Repository navigation
Expand file tree
/
Copy pathCross.toml
More file actions
63 lines (59 loc) · 3.76 KB
/
Copy pathCross.toml
File metadata and controls
63 lines (59 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Configuration for `cross` (https://github.com/cross-rs/cross), used only for
# the Linux aarch64 rows of the release matrix.
#
# WHY cross and not plain rustup targets: rustup gives us the Rust std for the
# target, but a C toolchain, linker, and sysroot still have to come from
# somewhere. cross ships them in pinned container images, which is both less
# host-machine setup and more reproducible than whatever gcc-aarch64 package a
# runner happens to have. x86_64 Linux (glibc and musl) builds natively on the
# ubuntu runner and does not go through cross at all.
#
# WHY images are pinned by digest-tag rather than "latest": an image bump can
# silently change the glibc floor of the produced binary. Bumps happen in
# their own PR, like toolchain bumps.
[build]
# Fetch on the host with the host's git/credentials, then hand vendored
# sources to the container. Avoids network access from inside the build
# container, which is one less variable for reproducibility.
default-target = "x86_64-unknown-linux-gnu"
[build.env]
# Reproducibility variables must cross the container boundary or the
# container build and the host build stop being comparable.
passthrough = ["SOURCE_DATE_EPOCH", "RUSTFLAGS", "CARGO_INCREMENTAL", "PKG_CONFIG_ALLOW_CROSS", "PKG_CONFIG_PATH"]
[target.aarch64-unknown-linux-gnu]
# NOTE: the cross 0.2.5 image's aarch64 *sysroot* glibc is pre-2.29 (the
# link step rejects GLIBC_2.29 math symbols), so the effective floor of the
# shipped aarch64 binary is at most glibc 2.28, which covers Debian 10+,
# Ubuntu 18.04+, RHEL 8+. Raising this floor is a user-visible
# compatibility change; treat like an MSRV bump.
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:0.2.5"
# alsa-sys needs the *target-arch* ALSA headers/libs inside the container.
# The image is x86_64 Ubuntu 20.04; arm64 packages live on ports.ubuntu.com,
# which is not in the default sources, so it is added here for arm64 only.
pre-build = [
"dpkg --add-architecture arm64",
"sed -i 's/^deb http/deb [arch=amd64] http/' /etc/apt/sources.list",
# bionic, NOT focal: the image's aarch64 sysroot glibc is older than
# 2.29 (linking focal's libasound fails with "undefined reference to
# exp@GLIBC_2.29": glibc 2.29 moved the libm math symbols). bionic's
# libasound2 1.1.3 is built against glibc 2.27 and links clean, and
# alsa-sys only needs the classic snd_pcm_* surface, present since 1.0.
"echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports bionic main universe' >> /etc/apt/sources.list",
"echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports bionic-updates main universe' >> /etc/apt/sources.list",
"echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports bionic-security main universe' >> /etc/apt/sources.list",
# Extract, don't install: apt refuses to install any arm64 library into
# this image because every Multi-Arch: same pair (libc6, libcrypt1,
# gcc-10-base, ...) must match the amd64 copy byte-for-byte, and no
# amount of upgrade/dist-upgrade converges (tried; each run failed one
# library deeper). We do not need a coherent arm64 userland, only
# ALSA's headers, .so symlink, and alsa.pc for the LINK step; the
# aarch64 sysroot glibc that resolves the final link ships with the
# cross toolchain itself. `apt-get download` + `dpkg -x /` lays the
# files down with no dependency resolution at all.
"apt-get update && apt-get install -y pkg-config",
"cd /tmp && apt-get download libasound2:arm64 libasound2-dev:arm64 && for f in /tmp/libasound2*.deb; do dpkg -x \"$f\" /; done",
]
[target.aarch64-unknown-linux-musl]
# Musl target is fully static (see .cargo/config.toml), so the image choice
# affects only the build environment, not the runtime floor of the binary.
image = "ghcr.io/cross-rs/aarch64-unknown-linux-musl:0.2.5"