Skip to content

Commit 00dedc9

Browse files
committed
Add toolchain requirements blog post
1 parent a601c3a commit 00dedc9

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
layout: post
3+
title: "Increasing the glibc and kernel requirements"
4+
author: Nikita Popov
5+
---
6+
7+
The minimum requirements for Rust toolchains targeting Linux will [increase][PR] with the
8+
Rust 1.64.0 release (slated for September 22nd, 2022). The new minimum requirements are:
9+
10+
* glibc >= 2.17 (previously glibc >= 2.11)
11+
* kernel >= 3.2 (previously kernel >= 2.6.32)
12+
13+
These requirements apply both to running the Rust compiler itself (and other Rust tooling like
14+
Cargo or Rustup), and to running binaries produced by Rust, if they use the libstd.
15+
16+
If you are not targeting an old long-term-support distribution, or embedded hardware running
17+
an old Linux version, this change is unlikely to affect you. Otherwise, read on!
18+
19+
# Affected targets
20+
21+
In principle, the new kernel requirements affect all `*-linux-*` targets, while the glibc
22+
requirements affect all `*-linux-gnu*` targets. In practice, many targets were already requiring
23+
newer kernel or glibc versions. The requirements for such targets do not change.
24+
25+
Among targets for which a Rust host toolchain is distributed, the following *are* affected:
26+
27+
* `i686-unknown-linux-gnu` (Tier 1)
28+
* `x86_64-unknown-linux-gnu` (Tier 1)
29+
* `x86_64-unknown-linux-musl` (Tier 2 with host tools)
30+
* `powerpc-unknown-linux-gnu` (Tier 2 with host tools)
31+
* `powerpc64-unknown-linux-gnu` (Tier 2 with host tools)
32+
* `s390x-unknown-linux-gnu` (Tier 2 with host tools)
33+
34+
The following are *not* affected, because they already had higher glibc/kernel requirements:
35+
36+
* `aarch64-unknown-linux-gnu` (Tier 1)
37+
* `aarch64-unknown-linux-musl` (Tier 2 with host tools)
38+
* `arm-unknown-linux-gnueabi` (Tier 2 with host tools)
39+
* `arm-unknown-linux-gnueabihf` (Tier 2 with host tools)
40+
* `armv7-unknown-linux-gnueabihf` (Tier 2 with host tools)
41+
* `mips-unknown-linux-gnueabihf` (Tier 2 with host tools)
42+
* `powerpc64le-unknown-linux-gnueabihf` (Tier 2 with host tools)
43+
* `riscv64gc-unknown-linux-gnueabihf` (Tier 2 with host tools)
44+
45+
For other tier 2 or tier 3 targets, for which no Rust toolchain is distributed, we do not
46+
accurately track minimum requirements, and they may or may not be affected by this change.
47+
`*-linux-musl*` targets are only affected by the kernel requirements, not the glibc requirements.
48+
Targets which only use libcore and not libstd are unaffected.
49+
50+
# Affected systems
51+
52+
The glibc and kernel versions used for the new baseline requirements are already close to a decade
53+
old. As such, this change should only affect users that either target old long-term-support Linux
54+
distributions, or embedded hardware running old versions of Linux.
55+
56+
The following Linux distributions *are* still supported under the new requirements:
57+
58+
* RHEL 7 (glibc 2.17, kernel 3.10)
59+
* SLES 12-SP5 (glibc 2.22, kernel 4.12.14)
60+
* Debian 8 (glibc 2.19, kernel 3.16.7)
61+
* Ubuntu 14.04 (glibc 2.19, kernel 3.13)
62+
63+
The following distributions are *not* supported under the new requirements:
64+
65+
* RHEL 6 (glibc 2.12, kernel 2.6.32)
66+
* SLES 11-SP4 (glibc 2.11.3, kernel 3.0.101)
67+
* Debian 6 (glibc 2.11, kernel 2.6.32), Debian 7 (glibc 3.12, kernel 3.2.41)
68+
* Ubuntu 12.04 (glibc 2.15, kernel 3.2)
69+
70+
Out of the distributions in the second list, only RHEL 6 still has limited vendor support (ELS).
71+
72+
# Why increase the requirements?
73+
74+
We want Rust, and binaries produced by Rust, to be as widely usable as possible. At the same time,
75+
the Rust project only has limited resources to maintain compatibility with old environments.
76+
77+
There are two parts to the toolchain requirements: The minimum requirements for running the Rust
78+
compiler on a host system, and the minimum requirements for cross-compiled binaries.
79+
80+
The minimum requirements for host toolchains affect our build system. Rust CI produces binary
81+
artifacts for dozens of different targets. Creating binaries that support old glibc versions
82+
requires either building on an operating system with old glibc (for native builds) or using a
83+
buildroot with an old glibc version (for cross-compiled builds).
84+
85+
At the same time, Rust relies on LLVM for optimization and code generation, which regularly
86+
increases its toolchain requirements. LLVM 16 will require GCC 7.1 or newer (and LLVM 15 supports
87+
GCC 5.1 in name only). Creating a build environment that has both a very old glibc and a recent
88+
compiler becomes increasingly hard over time. crosstool-ng (which we use for most cross-compilation
89+
needs) does not support targeting both glibc 2.11, and using a compiler that satisfies the new LLVM
90+
requirements.
91+
92+
The requirements for cross-compiled binaries have a different motivation: They affect which kernel
93+
versions need to be supported by libstd. Increasing the kernel requirements allows libstd to use
94+
newer syscalls, without having to maintain and test compatibility with kernels that do not support
95+
them.
96+
97+
The new baseline requirements were picked as the least common denominator among long-term-support
98+
distributions that still have active support. This is currently RHEL 7 with glibc 2.17 and
99+
kernel 3.10. The kernel requirement is picked as 3.2 instead, because this is the minimum
100+
requirement of glibc itself, and there is little relevant API difference between these versions.
101+
102+
# What should I do?
103+
104+
If you or your organization are affected by this change, there are a number of viable options
105+
depending on your situation:
106+
107+
* Upgrade your target system, or raise the minimum requirements of your software, to satisfy the
108+
new constraints.
109+
* If you are running the Rust compiler on an old host, consider cross-compiling from a newer host
110+
instead.
111+
* If you are targeting an old glibc version, consider targeting musl instead.
112+
* If you are targeting an old kernel version and use libstd, you may be out of luck: In this case
113+
you may have to either freeze your current Rust version, or maintain a fork of libstd that
114+
supports older kernels.
115+
116+
[PR]: https://github.com/rust-lang/rust/pull/95026

0 commit comments

Comments
 (0)