Skip to content

Commit b40da75

Browse files
Merge pull request #1015 from nikic/toolchain-requirements
Add blog post about new toolchain requirements
2 parents a2dac0c + 0a2db13 commit b40da75

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
layout: post
3+
title: "Increasing the glibc and Linux 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+
A list of supported targets and their requirements can be found on the
51+
[platform support page][platform-support]. However, the page is not yet up to date with the changes
52+
announced here.
53+
54+
# Affected systems
55+
56+
The glibc and kernel versions used for the new baseline requirements are already close to a decade
57+
old. As such, this change should only affect users that either target old long-term-support Linux
58+
distributions, or embedded hardware running old versions of Linux.
59+
60+
The following Linux distributions *are* still supported under the new requirements:
61+
62+
* RHEL 7 (glibc 2.17, kernel 3.10)
63+
* SLES 12-SP5 (glibc 2.22, kernel 4.12.14)
64+
* Debian 8 (glibc 2.19, kernel 3.16.7)
65+
* Ubuntu 14.04 (glibc 2.19, kernel 3.13)
66+
67+
The following distributions are *not* supported under the new requirements:
68+
69+
* RHEL 6 (glibc 2.12, kernel 2.6.32)
70+
* SLES 11-SP4 (glibc 2.11.3, kernel 3.0.101)
71+
* Debian 6 (glibc 2.11, kernel 2.6.32), Debian 7 (glibc 2.13, kernel 3.2.41)
72+
* Ubuntu 12.04 (glibc 2.15, kernel 3.2)
73+
74+
Out of the distributions in the second list, only RHEL 6 still has limited vendor support (ELS).
75+
76+
# Why increase the requirements?
77+
78+
We want Rust, and binaries produced by Rust, to be as widely usable as possible. At the same time,
79+
the Rust project only has limited resources to maintain compatibility with old environments.
80+
81+
There are two parts to the toolchain requirements: The minimum requirements for running the Rust
82+
compiler on a host system, and the minimum requirements for cross-compiled binaries.
83+
84+
The minimum requirements for host toolchains affect our build system. Rust CI produces binary
85+
artifacts for dozens of different targets. Creating binaries that support old glibc versions
86+
requires either building on an operating system with old glibc (for native builds) or using a
87+
buildroot with an old glibc version (for cross-compiled builds).
88+
89+
At the same time, Rust relies on LLVM for optimization and code generation, which regularly
90+
increases its toolchain requirements. LLVM 16 will require GCC 7.1 or newer (and LLVM 15 supports
91+
GCC 5.1 in name only). Creating a build environment that has both a very old glibc and a recent
92+
compiler becomes increasingly hard over time. crosstool-ng (which we use for most cross-compilation
93+
needs) does not support targeting both glibc 2.11, and using a compiler that satisfies the new LLVM
94+
requirements.
95+
96+
The requirements for cross-compiled binaries have a different motivation: They affect which kernel
97+
versions need to be supported by libstd. Increasing the kernel requirements allows libstd to use
98+
newer syscalls, without having to maintain and test compatibility with kernels that do not support
99+
them.
100+
101+
The new baseline requirements were picked as the least common denominator among long-term-support
102+
distributions that still have active support. This is currently RHEL 7 with glibc 2.17 and
103+
kernel 3.10. The kernel requirement is picked as 3.2 instead, because this is the minimum
104+
requirement of glibc itself, and there is little relevant API difference between these versions.
105+
106+
# What should I do?
107+
108+
If you or your organization are affected by this change, there are a number of viable options
109+
depending on your situation:
110+
111+
* Upgrade your target system, or raise the minimum requirements of your software, to satisfy the
112+
new constraints.
113+
* If you are running the Rust compiler on an old host, consider cross-compiling from a newer host
114+
instead.
115+
* If you are targeting an old glibc version, consider targeting musl instead.
116+
* If you are targeting an old kernel version and use libstd, you may be out of luck: In this case
117+
you may have to either freeze your current Rust version, or maintain a fork of libstd that
118+
supports older kernels.
119+
120+
[PR]: https://github.com/rust-lang/rust/pull/95026
121+
[platform-support]: https://doc.rust-lang.org/nightly/rustc/platform-support.html

0 commit comments

Comments
 (0)