Skip to content

Commit 8aeb413

Browse files
cjpattonghedo
authored andcommitted
ci: use cross's edge images for multiarch test runs
The default `cross` images shipped with `cross 0.2.5` (2022) carry pre-C++17 g++ toolchains, which can't compile the upgraded BoringSSL (it needs C++17 headers like `<string_view>`). Override them with `cross`'s `edge` images, which are rebuilt regularly from cross's `main` branch and carry a current toolchain. The `edge` image for `i686-unknown-linux-gnu` is set up differently from the others: it's a 32-bit-native userspace shipping only the unprefixed `gcc`/`g++` toolchain, missing some of the 32-bit dev libraries needed by `cmake`'s compiler-detection probe, and lacks the cross-prefixed binary names that `cross` and `cc-rs` expect. Add a `pre-build` step to install `libc6-dev-i386 g++-multilib` and to symlink `i686-linux-gnu-gcc`/`-g++` to the unprefixed compilers. Separately, BoringSSL's x86 assembly requires SSE2. The 32-bit toolchain file sets `-msse2`, but cmake-rs passes `-DCMAKE_C_FLAGS=...` on the command line which wins over the toolchain file's CACHE STRING, leaving SSE2 unset in the actual build flags. Add `-msse2` (and `-mfpmath=sse`) for the x86 build path in `build.rs` so they make it into the final flags regardless. An earlier attempt switched the multiarch CI job from `cross` to native apt cross-toolchains plus `qemu-user-static`. That approach worked but `qemu-user-static` introduced enough nondeterminism in microsecond-level timing that several BBR2-parameterized byte-count assertions started flaking on aarch64 and armv7 across different runs of the same code. `cross`'s Docker+QEMU setup is deterministic enough in practice to keep those tests stable, so we keep using `cross` and address its toolchain age via `Cross.toml`.
1 parent f2fcea4 commit 8aeb413

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

Cross.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Use `cross`'s `edge` images instead of the default `latest` (pinned to
2+
# cross 0.2.5, published 2022). The stock `latest` images for these
3+
# targets ship pre-C++17 g++ toolchains, which can't build BoringSSL 5.x
4+
# (it requires C++17 headers like `<string_view>`). The `edge` images
5+
# are rebuilt regularly from cross's `main` branch and carry a newer
6+
# toolchain.
7+
8+
[target.aarch64-unknown-linux-gnu]
9+
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:edge"
10+
11+
[target.armv7-unknown-linux-gnueabihf]
12+
image = "ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf:edge"
13+
14+
# The `edge` image for i686 is a 32-bit-native userspace and ships only
15+
# the unprefixed `gcc`/`g++` toolchain. We need:
16+
# - 32-bit dev libraries (`Scrt1.o`, `crti.o`, etc.) so cmake's
17+
# compiler-detection probe can link a trivial test program.
18+
# - Symlinks for `i686-linux-gnu-{gcc,g++}` so `cross` (which sets
19+
# `linker=i686-linux-gnu-gcc`) and `cc-rs`-based crates (e.g.,
20+
# `ring`) can find a compiler under the cross-prefixed names they
21+
# expect.
22+
[target.i686-unknown-linux-gnu]
23+
image = "ghcr.io/cross-rs/i686-unknown-linux-gnu:edge"
24+
pre-build = [
25+
"dpkg --add-architecture i386",
26+
"apt-get update && apt-get install --assume-yes libc6-dev-i386 g++-multilib",
27+
"ln -sf /usr/bin/gcc /usr/local/bin/i686-linux-gnu-gcc",
28+
"ln -sf /usr/bin/g++ /usr/local/bin/i686-linux-gnu-g++",
29+
]

quiche/src/build.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ fn get_boringssl_cmake_config() -> cmake::Config {
149149
.as_os_str(),
150150
);
151151

152+
// BoringSSL's x86 assembly requires SSE2. The toolchain
153+
// file sets `-msse2`, but cmake-rs passes
154+
// `-DCMAKE_C_FLAGS=...` on the command line, which wins
155+
// over the toolchain file's CACHE STRING. Add `-msse2`
156+
// (and `-mfpmath=sse`) here so they make it into the
157+
// final flags regardless.
158+
boringssl_cmake.cflag("-msse2").cflag("-mfpmath=sse");
159+
boringssl_cmake.cxxflag("-msse2").cxxflag("-mfpmath=sse");
160+
boringssl_cmake.asmflag("-msse2");
161+
152162
boringssl_cmake
153163
},
154164

0 commit comments

Comments
 (0)