Skip to content

Commit

Permalink
Drop manylinux2010 support
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Aug 3, 2022
1 parent 9f4c1d2 commit 9249321
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
- name: Build wheel (with sdist)
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
cargo run -- build --release -b bin --sdist -o dist --target ${{ matrix.target }} --features password-storage --compatibility manylinux2010 musllinux_1_1
cargo run -- build --release -b bin --sdist -o dist --target ${{ matrix.target }} --features password-storage --compatibility manylinux2014 musllinux_1_1
# ring doesn't support aarch64 windows yet
- name: Build wheel (windows aarch64)
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
platform: [
{ target: "aarch64-unknown-linux-musl", image_tag: "aarch64-musl", manylinux: "2014" },
{ target: "armv7-unknown-linux-musleabihf", image_tag: "armv7-musleabihf", manylinux: "2014"},
{ target: "i686-unknown-linux-musl", image_tag: "i686-musl", manylinux: "2010"},
{ target: "i686-unknown-linux-musl", image_tag: "i686-musl", manylinux: "2014"},
]
container:
image: docker://messense/rust-musl-cross:${{ matrix.platform.image_tag }}
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/pypa/manylinux2010_x86_64 as builder
FROM quay.io/pypa/manylinux2014_x86_64 as builder

ENV PATH /root/.cargo/bin:$PATH

Expand All @@ -24,7 +24,7 @@ RUN cargo rustc --bin maturin --manifest-path /maturin/Cargo.toml --release --fe
&& mv /maturin/target/release/maturin /usr/bin/maturin \
&& rm -rf /maturin

FROM quay.io/pypa/manylinux2010_x86_64
FROM quay.io/pypa/manylinux2014_x86_64

ENV PATH /root/.cargo/bin:$PATH
# Add all supported python versions
Expand Down
6 changes: 3 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,18 @@ There's a `maturin sdist` command for only building a source distribution as wor
## Manylinux and auditwheel

For portability reasons, native python modules on linux must only dynamically link a set of very few libraries which are installed basically everywhere, hence the name manylinux.
The pypa offers special docker images and a tool called [auditwheel](https://github.com/pypa/auditwheel/) to ensure compliance with the [manylinux rules](https://www.python.org/dev/peps/pep-0571/#the-manylinux2010-policy).
The pypa offers special docker images and a tool called [auditwheel](https://github.com/pypa/auditwheel/) to ensure compliance with the [manylinux rules](https://peps.python.org/pep-0599/#the-manylinux2014-policy).
If you want to publish widely usable wheels for linux pypi, **you need to use a manylinux docker image**.

The Rust compiler since version 1.47 [requires at least glibc 2.11](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1470-2020-10-08), so you need to use at least manylinux2010.
The Rust compiler since version 1.64 [requires at least glibc 2.17](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html), so you need to use at least manylinux2014.
For publishing, we recommend enforcing the same manylinux version as the image with the manylinux flag, e.g. use `--manylinux 2014` if you are building in `quay.io/pypa/manylinux2014_x86_64`.
The [messense/maturin-action](https://github.com/messense/maturin-action) github action already takes care of this if you set e.g. `manylinux: 2014`.

maturin contains a reimplementation of auditwheel automatically checks the generated library and gives the wheel the proper.
If your system's glibc is too new or you link other shared libraries, it will assign the `linux` tag.
You can also manually disable those checks and directly use native linux target with `--manylinux off`.

For full manylinux compliance you need to compile in a CentOS docker container. The [pyo3/maturin](https://ghcr.io/pyo3/maturin) image is based on the manylinux2010 image,
For full manylinux compliance you need to compile in a CentOS docker container. The [pyo3/maturin](https://ghcr.io/pyo3/maturin) image is based on the manylinux2014 image,
and passes arguments to the `maturin` binary. You can use it like this:

```
Expand Down
12 changes: 6 additions & 6 deletions guide/src/distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ sdist-include = ["path/**/*"]
## Build Wheels

For portability reasons, native python modules on linux must only dynamically link a set of very few libraries which are installed basically everywhere, hence the name manylinux.
The pypa offers special docker images and a tool called [auditwheel](https://github.com/pypa/auditwheel/) to ensure compliance with the [manylinux rules](https://www.python.org/dev/peps/pep-0571/#the-manylinux2010-policy).
The pypa offers special docker images and a tool called [auditwheel](https://github.com/pypa/auditwheel/) to ensure compliance with the [manylinux rules](https://peps.python.org/pep-0599/#the-manylinux2014-policy)).
If you want to publish widely usable wheels for linux pypi, **you need to use a manylinux docker image** or [build with zig](#use-zig).

The Rust compiler since version 1.47 [requires at least glibc 2.11](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1470-2020-10-08), so you need to use at least manylinux2010.
The Rust compiler since version 1.64 [requires at least glibc 2.17](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html), so you need to use at least manylinux2014.
For publishing, we recommend enforcing the same manylinux version as the image with the manylinux flag, e.g. use `--manylinux 2014` if you are building in `quay.io/pypa/manylinux2014_x86_64`.
The [messense/maturin-action](https://github.com/messense/maturin-action) github action already takes care of this if you set e.g. `manylinux: 2014`.

Expand Down Expand Up @@ -93,9 +93,9 @@ OPTIONS:
Options are `manylinux` tags (for example `manylinux2014`/`manylinux_2_24`) or
`musllinux` tags (for example `musllinux_1_2`) and `linux` for the native linux tag.
Note that `manylinux1` is unsupported by the rust compiler. Wheels with the native
`linux` tag will be rejected by pypi, unless they are separately validated by
`auditwheel`.
Note that `manylinux1` and `manylinux2010` is unsupported by the rust compiler.
Wheels with the native `linux` tag will be rejected by pypi, unless they are separately
validated by `auditwheel`.
The default is the lowest compatible `manylinux` tag, or plain `linux` if nothing
matched
Expand All @@ -122,7 +122,7 @@ OPTIONS:
--zig
For manylinux targets, use zig to ensure compliance for the chosen manylinux version
Default to manylinux2010/manylinux_2_12 if you do not specify an `--compatibility`
Default to manylinux2014/manylinux_2_17 if you do not specify an `--compatibility`
Make sure you installed zig with `pip install maturin[zig]`
Expand Down
9 changes: 9 additions & 0 deletions src/auditwheel/platform_tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ impl PlatformTag {
pub fn is_musllinux(&self) -> bool {
matches!(self, PlatformTag::Musllinux { .. })
}

/// Is it supported by Rust compiler
pub fn is_supported(&self) -> bool {
match self {
PlatformTag::Manylinux { x, y } => (*x, *y) >= (2, 17),
PlatformTag::Musllinux { .. } => true,
PlatformTag::Linux => true,
}
}
}

impl fmt::Display for PlatformTag {
Expand Down
20 changes: 12 additions & 8 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ pub struct BuildOptions {
/// or `musllinux` tags (for example `musllinux_1_2`)
/// and `linux` for the native linux tag.
///
/// Note that `manylinux1` is unsupported by the rust compiler. Wheels with the native `linux` tag
/// will be rejected by pypi, unless they are separately validated by `auditwheel`.
/// Note that `manylinux1` and `manylinux2010` is unsupported by the rust compiler.
/// Wheels with the native `linux` tag will be rejected by pypi,
/// unless they are separately validated by `auditwheel`.
///
/// The default is the lowest compatible `manylinux` tag, or plain `linux` if nothing matched
///
Expand Down Expand Up @@ -182,7 +183,7 @@ pub struct BuildOptions {

/// For manylinux targets, use zig to ensure compliance for the chosen manylinux version
///
/// Default to manylinux2010/manylinux_2_12 if you do not specify an `--compatibility`
/// Default to manylinux2014/manylinux_2_17 if you do not specify an `--compatibility`
///
/// Make sure you installed zig with `pip install maturin[zig]`
#[clap(long)]
Expand Down Expand Up @@ -718,11 +719,14 @@ impl BuildOptions {
} else {
self.platform_tag
};
if platform_tags
.iter()
.any(|tag| tag == &PlatformTag::manylinux1())
{
eprintln!("⚠️ Warning: manylinux1 is unsupported by the Rust compiler.");

for platform_tag in &platform_tags {
if !platform_tag.is_supported() {
eprintln!(
"⚠️ Warning: {} is unsupported by the Rust compiler.",
platform_tag
);
}
}

match bridge {
Expand Down
2 changes: 1 addition & 1 deletion src/python_interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ impl PythonInterpreter {
}
InterpreterKind::PyPy => {
// pypy uses its version as part of the ABI, e.g.
// pypy 3.7 7.3 => numpy-1.20.1-pp37-pypy37_pp73-manylinux2010_x86_64.whl
// pypy 3.7 7.3 => numpy-1.20.1-pp37-pypy37_pp73-manylinux2014_x86_64.whl
format!(
"pp{major}{minor}-pypy{major}{minor}_{abi_tag}-{platform}",
major = self.major,
Expand Down
11 changes: 7 additions & 4 deletions src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,13 @@ impl Target {
/// Returns the oldest possible Manylinux tag for this architecture
pub fn get_minimum_manylinux_tag(&self) -> PlatformTag {
match self.arch {
Arch::Aarch64 | Arch::Armv7L | Arch::Powerpc64 | Arch::Powerpc64Le | Arch::S390X => {
PlatformTag::manylinux2014()
}
Arch::X86 | Arch::X86_64 => PlatformTag::manylinux2010(),
Arch::Aarch64
| Arch::Armv7L
| Arch::Powerpc64
| Arch::Powerpc64Le
| Arch::S390X
| Arch::X86
| Arch::X86_64 => PlatformTag::manylinux2014(),
Arch::Armv6L
| Arch::Wasm32
| Arch::Riscv64
Expand Down
2 changes: 1 addition & 1 deletion tests/common/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn test_integration(
if zig && build_context.target.is_linux() && !build_context.target.is_musl_target() {
assert!(filename
.to_string_lossy()
.ends_with("manylinux_2_12_x86_64.manylinux2010_x86_64.whl"))
.ends_with("manylinux_2_17_x86_64.manylinux2014_x86_64.whl"))
}
let venv_suffix = if supported_version == "py3" {
"py3".to_string()
Expand Down

0 comments on commit 9249321

Please sign in to comment.