diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 86247757d..36ad7cac1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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) @@ -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 }} diff --git a/Dockerfile b/Dockerfile index a222bb056..675d5a422 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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 diff --git a/Readme.md b/Readme.md index 3c538fcad..fea639e0d 100644 --- a/Readme.md +++ b/Readme.md @@ -224,10 +224,10 @@ 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`. @@ -235,7 +235,7 @@ maturin contains a reimplementation of auditwheel automatically checks the gener 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: ``` diff --git a/guide/src/distribution.md b/guide/src/distribution.md index da59195e8..018d843a7 100644 --- a/guide/src/distribution.md +++ b/guide/src/distribution.md @@ -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`. @@ -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 @@ -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]` diff --git a/src/auditwheel/platform_tag.rs b/src/auditwheel/platform_tag.rs index 2ad45d3dc..f2e57d541 100644 --- a/src/auditwheel/platform_tag.rs +++ b/src/auditwheel/platform_tag.rs @@ -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 { diff --git a/src/build_options.rs b/src/build_options.rs index c80df2f98..f67081770 100644 --- a/src/build_options.rs +++ b/src/build_options.rs @@ -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 /// @@ -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)] @@ -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 { diff --git a/src/python_interpreter/mod.rs b/src/python_interpreter/mod.rs index a74dd25e0..fcd83f12d 100644 --- a/src/python_interpreter/mod.rs +++ b/src/python_interpreter/mod.rs @@ -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, diff --git a/src/target.rs b/src/target.rs index b8fcce278..a5112122a 100644 --- a/src/target.rs +++ b/src/target.rs @@ -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 diff --git a/tests/common/integration.rs b/tests/common/integration.rs index b2064918a..afecce4c5 100644 --- a/tests/common/integration.rs +++ b/tests/common/integration.rs @@ -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()