Skip to content

Commit e4cbe6c

Browse files
committed
fix: use bullseye base for Docker build, drop glibc floor from 2.34 to 2.29
1 parent 2a35489 commit e4cbe6c

2 files changed

Lines changed: 26 additions & 21 deletions

File tree

docs-internal/arch/glibc-portability.md

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,38 @@
33
## Summary
44

55
The `secure-exec-v8` binary (Rust + V8 engine) is dynamically linked against glibc.
6-
The minimum glibc version on target systems is determined by two factors:
6+
The minimum glibc version on target systems is determined by the build environment's glibc version, because the linker stamps versioned symbol requirements into the binary at link time.
77

8-
1. **rusty_v8 prebuilt static libraries** require **glibc >= 2.32** (due to `sem_clockwait` in V8's `sem_waiter.o`)
9-
2. **Rust standard library** links against pthread symbols that were re-versioned in **glibc 2.34** when `libpthread.so` was merged into `libc.so.6`
8+
The two key factors:
109

11-
If we build on a system with glibc >= 2.34, the resulting binary requires glibc >= 2.34 at runtime because all pthread symbols (`pthread_create`, `sem_wait`, `dlsym`, etc.) get stamped with `GLIBC_2.34` version tags.
12-
13-
If we build on a system with glibc 2.32–2.33, pthread symbols resolve against the older separate `libpthread.so` version tags, and the effective floor drops to 2.32 (set by V8).
10+
1. **Rust standard library** links against pthread symbols. In glibc 2.34, `libpthread.so` was merged into `libc.so.6`, so all pthread symbols got re-versioned to `GLIBC_2.34`. Building on glibc < 2.34 avoids this jump.
11+
2. **rusty_v8 prebuilt static libraries** reference `sem_clockwait` (`GLIBC_2.30`) and other symbols. On Bullseye (glibc 2.31), `sem_clockwait` is available in the separate `libpthread.so`.
1412

1513
## Build base image policy
1614

17-
All Linux build environments (Dockerfiles, CI runners) must use **Ubuntu 22.04 (Jammy)** as the base, which ships glibc 2.35. This:
15+
All Linux build environments (Dockerfiles, CI runners) must use **Debian Bullseye (glibc 2.31)**.
16+
17+
This produces binaries requiring only **glibc >= 2.29**, verified empirically:
1818

19-
- Satisfies V8's hard floor of glibc 2.32
20-
- Produces binaries compatible with glibc 2.35+ systems
21-
- Covers Ubuntu 22.04+, Debian 12+, Amazon Linux 2023, Fedora 36+, RHEL 9+
19+
```
20+
BOOKWORM build: glibc floor = 2.34
21+
BULLSEYE build: glibc floor = 2.29
22+
```
2223

2324
Specifically:
24-
- Dockerfiles: `FROM rust:1.85.0-jammy` (not bookworm, not bullseye)
25-
- GitHub Actions: `ubuntu-22.04` (not `ubuntu-latest`, which floats)
25+
- Dockerfiles: `FROM rust:1.85.0-bullseye`
26+
- GitHub Actions: `ubuntu-22.04` (the oldest available runner; glibc 2.35, but still better than `ubuntu-latest` which floats to newer versions)
27+
28+
Note: GitHub Actions doesn't offer a Bullseye runner, so CI builds will have a higher glibc floor (~2.29 from Bullseye Docker, ~2.34 from ubuntu-22.04 runner). For maximum portability, prefer Docker-based builds.
2629

2730
## Why not older?
2831

29-
- **Bullseye (glibc 2.31)**: V8's `sem_clockwait` symbol requires 2.32. Linking would fail.
30-
- **CentOS 7 (glibc 2.17)**: Same problem, plus ancient toolchain.
32+
- **CentOS 7 (glibc 2.17)**: `sem_clockwait` and other symbols V8 needs don't exist.
33+
- **Buster (glibc 2.28)**: `sem_clockwait` (GLIBC_2.30) is missing from libpthread.
3134

3235
## Why not musl?
3336

34-
The rusty_v8 crate only ships prebuilt `.a` files for `*-linux-gnu` targets. Building V8 from source against musl would require patching V8's build system and takes 30–60 minutes per platform. Not worth it given the glibc 2.35 floor is adequate.
37+
The rusty_v8 crate only ships prebuilt `.a` files for `*-linux-gnu` targets. Building V8 from source against musl would require patching V8's build system and takes 30–60 minutes per platform. Not worth it given the glibc 2.29 floor covers virtually all active Linux distributions.
3538

3639
## How to verify
3740

@@ -47,12 +50,14 @@ The highest version in the output is the minimum glibc required at runtime.
4750

4851
| Distro | glibc | Compatible? |
4952
|---|---|---|
50-
| Ubuntu 20.04 | 2.31 | No |
51-
| Debian 11 (Bullseye) | 2.31 | No |
53+
| CentOS 7 | 2.17 | No |
5254
| Amazon Linux 2 | 2.26 | No |
55+
| Debian 10 (Buster) | 2.28 | No |
56+
| Ubuntu 20.04 | 2.31 | Yes |
57+
| Debian 11 (Bullseye) | 2.31 | Yes |
58+
| Amazon Linux 2023 | 2.34 | Yes |
5359
| Ubuntu 22.04 | 2.35 | Yes |
5460
| Debian 12 (Bookworm) | 2.36 | Yes |
55-
| Amazon Linux 2023 | 2.34 | Yes |
5661
| Ubuntu 24.04 | 2.39 | Yes |
5762
| Fedora 36+ | 2.35+ | Yes |
5863
| RHEL 9 | 2.34 | Yes |

native/v8-runtime/docker/Dockerfile.linux-x64-gnu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Build base pinned to Ubuntu 22.04 (glibc 2.35) for portability.
1+
# Build base pinned to Debian Bullseye (glibc 2.31) for portability.
22
# See docs-internal/arch/glibc-portability.md
3-
FROM rust:1.85.0-jammy AS builder
3+
FROM rust:1.85.0-bullseye AS builder
44
WORKDIR /build
5-
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
5+
COPY Cargo.toml Cargo.lock rust-toolchain.toml build.rs ./
66
RUN mkdir src && echo 'fn main() {}' > src/main.rs
77
RUN --mount=type=cache,target=/usr/local/cargo/registry \
88
--mount=type=cache,target=/usr/local/cargo/git \

0 commit comments

Comments
 (0)