diff --git a/Changelog.md b/Changelog.md index 848d01933..271b50723 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (for the cli, not for the crate). +## Unreleased + +* Add `manylinux_2_27` support in [#521](https://github.com/PyO3/maturin/pull/521) + ## 0.10.4 - 2021-04-28 * Interpreter search now uses python 3.6 to 3.12 in [#495](https://github.com/PyO3/maturin/pull/495) diff --git a/Readme.md b/Readme.md index 2dbfd7e9e..d2aa61b82 100644 --- a/Readme.md +++ b/Readme.md @@ -242,14 +242,14 @@ OPTIONS: The python versions to build wheels for, given as the names of the interpreters. Uses autodiscovery if not explicitly set --manylinux - Control the platform tag on linux. Options are `2010` (for manylinux2010), `2014` (for manylinux2014), - `2_24` (for manylinux_2_24) and `off` (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`. + Control the platform tag on linux. Options are `2010`/`2_12` (for manylinux2010), `2014`/`2_17` (for + manylinux2014), `2_24` (for manylinux_2_24), `2_27` (for manylinux_2_27) and `off` (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`. The default is the lowest compatible, of plain `linux` if nothing matched - This option is ignored on all non-linux platforms [possible values: 2010, 2014, 2_24, off] + This option is ignored on all non-linux platforms [possible values: 2010, 2014, 2_12, 2_17, 2_24, 2_27, off] -o, --out The directory to store the built wheels in. Defaults to a new "wheels" directory in the project's target directory @@ -311,14 +311,14 @@ OPTIONS: The python versions to build wheels for, given as the names of the interpreters. Uses autodiscovery if not explicitly set --manylinux - Control the platform tag on linux. Options are `2010` (for manylinux2010), `2014` (for manylinux2014), - `2_24` (for manylinux_2_24) and `off` (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`. + Control the platform tag on linux. Options are `2010`/`2_12` (for manylinux2010), `2014`/`2_17` (for + manylinux2014), `2_24` (for manylinux_2_24), `2_27` (for manylinux_2_27) and `off` (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`. The default is the lowest compatible, of plain `linux` if nothing matched - This option is ignored on all non-linux platforms [possible values: 2010, 2014, 2_24, off] + This option is ignored on all non-linux platforms [possible values: 2010, 2014, 2_12, 2_17, 2_24, 2_27, off] -o, --out The directory to store the built wheels in. Defaults to a new "wheels" directory in the project's target directory diff --git a/src/auditwheel/manylinux.rs b/src/auditwheel/manylinux.rs index da94bbd4e..47c40fb88 100644 --- a/src/auditwheel/manylinux.rs +++ b/src/auditwheel/manylinux.rs @@ -5,26 +5,37 @@ use std::str::FromStr; /// Decides how to handle manylinux compliance #[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq, Copy)] pub enum Manylinux { - /// Use the manylinux1 tag - Manylinux1, - /// Use the manylinux2010 tag - Manylinux2010, - /// Use the manylinux2014 tag - Manylinux2014, - /// Use the manylinux_2_24 tag - #[allow(non_camel_case_types)] - Manylinux_2_24, + /// Use the manylinux_x_y tag + Manylinux { + /// GLIBC version major + x: u16, + /// GLIBC version minor + y: u16, + }, /// Use the native linux tag Off, } +impl Manylinux { + fn new(x: u16, y: u16) -> Self { + Self::Manylinux { x, y } + } + + /// manylinux2010 + pub fn manylinux2010() -> Self { + Self::Manylinux { x: 2, y: 12 } + } + + /// manylinux2014 + pub fn manylinux2014() -> Self { + Self::Manylinux { x: 2, y: 17 } + } +} + impl fmt::Display for Manylinux { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { - Manylinux::Manylinux1 => write!(f, "manylinux1"), - Manylinux::Manylinux2010 => write!(f, "manylinux2010"), - Manylinux::Manylinux2014 => write!(f, "manylinux2014"), - Manylinux::Manylinux_2_24 => write!(f, "manylinux_2_24"), + Manylinux::Manylinux { x, y } => write!(f, "manylinux_{}_{}", x, y), Manylinux::Off => write!(f, "linux"), } } @@ -35,13 +46,23 @@ impl FromStr for Manylinux { fn from_str(value: &str) -> anyhow::Result { match value { - "auto" => Ok(Manylinux::Manylinux1), - "1" | "manylinux1" => Ok(Manylinux::Manylinux1), - "2010" | "manylinux2010" => Ok(Manylinux::Manylinux2010), - "2014" | "manylinux2014" => Ok(Manylinux::Manylinux2014), - "2_24" | "manylinux_2_24" => Ok(Manylinux::Manylinux_2_24), "off" | "linux" => Ok(Manylinux::Off), - _ => Err("Invalid value for the manylinux option"), + "auto" | "1" | "manylinux1" => Ok(Manylinux::new(2, 5)), + "2010" | "manylinux2010" => Ok(Manylinux::new(2, 12)), + "2014" | "manylinux2014" => Ok(Manylinux::new(2, 17)), + _ => { + let value = value.strip_prefix("manylinux_").unwrap_or(value); + let mut parts = value.split('_'); + let x = parts + .next() + .and_then(|x| x.parse::().ok()) + .ok_or("invalid manylinux option")?; + let y = parts + .next() + .and_then(|y| y.parse::().ok()) + .ok_or("invalid manylinux option")?; + Ok(Manylinux::new(x, y)) + } } } } diff --git a/src/auditwheel/policy.json b/src/auditwheel/policy.json index 7c9b722fc..a8efca23f 100644 --- a/src/auditwheel/policy.json +++ b/src/auditwheel/policy.json @@ -1,16 +1,18 @@ [ {"name": "linux", + "aliases": [], "priority": 0, "symbol_versions": {}, "lib_whitelist": [] }, - {"name": "manylinux1", + {"name": "manylinux_2_5", + "aliases": ["manylinux1"], "priority": 100, "symbol_versions": { "i686": { "CXXABI": ["1.3", "1.3.1"], - "GCC": ["3.0", "3.3", "3.3.1", "3.4", "3.4.2", "3.4.4", "4.0.0", "4.2.0"], - "GLIBC": ["2.0", "2.1", "2.1.1", "2.1.2", "2.1.3", "2.2", "2.2.1", "2.2.2", "2.2.3", "2.2.4", "2.2.5", "2.2.6", "2.3", "2.3.2", "2.3.3", "2.3.4", "2.4", "2.5"], + "GCC": ["3.0", "3.3", "3.3.1", "3.4", "3.4.2", "4.0.0", "4.2.0"], + "GLIBC": ["2.0", "2.1", "2.1.1", "2.1.2", "2.1.3", "2.2", "2.2.1", "2.2.2", "2.2.3", "2.2.4", "2.2.6", "2.3", "2.3.2", "2.3.3", "2.3.4", "2.4", "2.5"], "GLIBCXX": ["3.4", "3.4.1", "3.4.2", "3.4.3", "3.4.4", "3.4.5", "3.4.6", "3.4.7", "3.4.8"] }, "x86_64": { @@ -21,7 +23,6 @@ } }, "lib_whitelist": [ - "libpanelw.so.5", "libncursesw.so.5", "libgcc_s.so.1", "libstdc++.so.6", "libm.so.6", "libdl.so.2", "librt.so.1", @@ -30,7 +31,8 @@ "libSM.so.6", "libGL.so.1", "libgobject-2.0.so.0", "libgthread-2.0.so.0", "libglib-2.0.so.0", "libresolv.so.2" ]}, - {"name": "manylinux2010", + {"name": "manylinux_2_12", + "aliases": ["manylinux2010"], "priority": 90, "symbol_versions": { "i686": { @@ -53,9 +55,11 @@ "libc.so.6", "libnsl.so.1", "libutil.so.1", "libpthread.so.0", "libX11.so.6", "libXext.so.6", "libXrender.so.1", "libICE.so.6", "libSM.so.6", "libGL.so.1", "libgobject-2.0.so.0", - "libgthread-2.0.so.0", "libglib-2.0.so.0", "libresolv.so.2" + "libgthread-2.0.so.0", "libglib-2.0.so.0", "libresolv.so.2", + "libexpat.so.1" ]}, - {"name": "manylinux2014", + {"name": "manylinux_2_17", + "aliases": ["manylinux2014"], "priority": 80, "symbol_versions": { "i686": { @@ -108,9 +112,11 @@ "libc.so.6", "libnsl.so.1", "libutil.so.1", "libpthread.so.0", "libX11.so.6", "libXext.so.6", "libXrender.so.1", "libICE.so.6", "libSM.so.6", "libGL.so.1", "libgobject-2.0.so.0", - "libgthread-2.0.so.0", "libglib-2.0.so.0", "libresolv.so.2" + "libgthread-2.0.so.0", "libglib-2.0.so.0", "libresolv.so.2", + "libexpat.so.1" ]}, {"name": "manylinux_2_24", + "aliases": [], "priority": 70, "symbol_versions": { "i686": { @@ -157,6 +163,58 @@ "libc.so.6", "libnsl.so.1", "libutil.so.1", "libpthread.so.0", "libX11.so.6", "libXext.so.6", "libXrender.so.1", "libICE.so.6", "libSM.so.6", "libGL.so.1", "libgobject-2.0.so.0", - "libgthread-2.0.so.0", "libglib-2.0.so.0", "libresolv.so.2" + "libgthread-2.0.so.0", "libglib-2.0.so.0", "libresolv.so.2", + "libexpat.so.1" + ]}, + {"name": "manylinux_2_27", + "aliases": [], + "priority": 65, + "symbol_versions": { + "i686": { + "CXXABI": ["1.3", "1.3.1", "1.3.2", "1.3.3", "1.3.4", "1.3.5", "1.3.6", "1.3.7", "1.3.8", "1.3.9", "1.3.10", "1.3.11", "FLOAT128", "TM_1"], + "GCC": ["3.0", "3.3", "3.3.1", "3.4", "3.4.2", "4.0.0", "4.2.0", "4.3.0", "4.4.0", "4.5.0", "4.7.0", "4.8.0", "7.0.0"], + "GLIBC": ["2.0", "2.1", "2.1.1", "2.1.2", "2.1.3", "2.2", "2.2.1", "2.2.2", "2.2.3", "2.2.4", "2.2.6", "2.3", "2.3.2", "2.3.3", "2.3.4", "2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "2.10", "2.11", "2.12", "2.13", "2.14", "2.15", "2.16", "2.17", "2.18", "2.22", "2.23", "2.24", "2.25", "2.26", "2.27"], + "GLIBCXX": ["3.4", "3.4.1", "3.4.2", "3.4.3", "3.4.4", "3.4.5", "3.4.6", "3.4.7", "3.4.8", "3.4.9", "3.4.10", "3.4.11", "3.4.12", "3.4.13", "3.4.14", "3.4.15", "3.4.16", "3.4.17", "3.4.18", "3.4.19", "3.4.20", "3.4.21", "3.4.22", "3.4.23", "3.4.24"] + }, + "x86_64": { + "CXXABI": ["1.3", "1.3.1", "1.3.2", "1.3.3", "1.3.4", "1.3.5", "1.3.6", "1.3.7", "1.3.8", "1.3.9", "1.3.10", "1.3.11", "FLOAT128", "TM_1"], + "GCC": ["3.0", "3.3", "3.3.1", "3.4", "3.4.2", "3.4.4", "4.0.0", "4.2.0", "4.3.0", "4.7.0", "4.8.0", "7.0.0"], + "GLIBC": ["2.2.5", "2.2.6", "2.3", "2.3.2", "2.3.3", "2.3.4", "2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "2.10", "2.11", "2.12", "2.13", "2.14", "2.15", "2.16", "2.17", "2.18", "2.22", "2.23", "2.24", "2.25", "2.26", "2.27"], + "GLIBCXX": ["3.4", "3.4.1", "3.4.2", "3.4.3", "3.4.4", "3.4.5", "3.4.6", "3.4.7", "3.4.8", "3.4.9", "3.4.10", "3.4.11", "3.4.12", "3.4.13", "3.4.14", "3.4.15", "3.4.16", "3.4.17", "3.4.18", "3.4.19", "3.4.20", "3.4.21", "3.4.22", "3.4.23", "3.4.24"] + }, + "aarch64": { + "CXXABI": ["1.3", "1.3.1", "1.3.2", "1.3.3", "1.3.4", "1.3.5", "1.3.6", "1.3.7", "1.3.8", "1.3.9", "1.3.10", "1.3.11", "TM_1"], + "GCC": ["3.0", "3.3", "3.3.1", "3.4", "3.4.2", "3.4.4", "4.0.0", "4.2.0", "4.3.0", "4.5.0", "4.7.0", "7.0.0"], + "GLIBC": ["2.0", "2.17", "2.18", "2.22", "2.23", "2.24", "2.25", "2.26", "2.27"], + "GLIBCXX": ["3.4", "3.4.1", "3.4.2", "3.4.3", "3.4.4", "3.4.5", "3.4.6", "3.4.7", "3.4.8", "3.4.9", "3.4.10", "3.4.11", "3.4.12", "3.4.13", "3.4.14", "3.4.15", "3.4.16", "3.4.17", "3.4.18", "3.4.19", "3.4.20", "3.4.21", "3.4.22", "3.4.23", "3.4.24"] + }, + "ppc64le": { + "CXXABI": ["1.3", "1.3.1", "1.3.2", "1.3.3", "1.3.4", "1.3.5", "1.3.6", "1.3.7", "1.3.8", "1.3.9", "1.3.10", "1.3.11", "LDBL_1.3", "TM_1"], + "GCC": ["3.0", "3.3", "3.3.1", "3.4", "3.4.2", "3.4.4", "4.0.0", "4.2.0", "4.3.0", "4.7.0", "7.0.0"], + "GLIBC": ["2.0", "2.17", "2.18", "2.22", "2.23", "2.24", "2.25", "2.26", "2.27"], + "GLIBCXX": ["3.4", "3.4.1", "3.4.2", "3.4.3", "3.4.4", "3.4.5", "3.4.6", "3.4.7", "3.4.8", "3.4.9", "3.4.10", "3.4.11", "3.4.12", "3.4.13", "3.4.14", "3.4.15", "3.4.16", "3.4.17", "3.4.18", "3.4.19", "3.4.20", "3.4.21", "3.4.22", "3.4.23", "3.4.24", "LDBL_3.4", "LDBL_3.4.10", "LDBL_3.4.21", "LDBL_3.4.7"] + }, + "s390x": { + "CXXABI": ["1.3", "1.3.1", "1.3.2", "1.3.3", "1.3.4", "1.3.5", "1.3.6", "1.3.7", "1.3.8", "1.3.9", "1.3.10", "1.3.11", "LDBL_1.3", "TM_1"], + "GCC": ["3.0", "3.3", "3.3.1", "3.4", "3.4.2", "3.4.4", "4.0.0", "4.1.0", "4.2.0", "4.3.0", "4.7.0", "7.0.0"], + "GLIBC": ["2.2", "2.2.1", "2.2.2", "2.2.3", "2.2.4", "2.2.6", "2.3", "2.3.2", "2.3.3", "2.3.4", "2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "2.10", "2.11", "2.12", "2.13", "2.14", "2.15", "2.16", "2.17", "2.18", "2.19", "2.22", "2.23", "2.24", "2.25", "2.26", "2.27"], + "GLIBCXX": ["3.4", "3.4.1", "3.4.2", "3.4.3", "3.4.4", "3.4.5", "3.4.6", "3.4.7", "3.4.8", "3.4.9", "3.4.10", "3.4.11", "3.4.12", "3.4.13", "3.4.14", "3.4.15", "3.4.16", "3.4.17", "3.4.18", "3.4.19", "3.4.20", "3.4.21", "3.4.22", "3.4.23", "3.4.24", "LDBL_3.4", "LDBL_3.4.10", "LDBL_3.4.21", "LDBL_3.4.7"] + }, + "armv7l": { + "CXXABI": ["1.3", "1.3.1", "1.3.2", "1.3.3", "1.3.4", "1.3.5", "1.3.6", "1.3.7", "1.3.8", "1.3.9", "1.3.10", "1.3.11", "ARM_1.3.3", "TM_1"], + "GCC": ["3.0", "3.3", "3.3.1", "3.3.4", "3.4", "3.4.2", "3.5", "4.0.0", "4.2.0", "4.3.0", "4.7.0", "7.0.0"], + "GLIBC": ["2.0", "2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "2.10", "2.11", "2.12", "2.13", "2.14", "2.15", "2.16", "2.17", "2.18", "2.22", "2.23", "2.24", "2.25", "2.26", "2.27"], + "GLIBCXX": ["3.4", "3.4.1", "3.4.2", "3.4.3", "3.4.4", "3.4.5", "3.4.6", "3.4.7", "3.4.8", "3.4.9", "3.4.10", "3.4.11", "3.4.12", "3.4.13", "3.4.14", "3.4.15", "3.4.16", "3.4.17", "3.4.18", "3.4.19", "3.4.20", "3.4.21", "3.4.22", "3.4.23", "3.4.24"] + } + }, + "lib_whitelist": [ + "libgcc_s.so.1", + "libstdc++.so.6", + "libm.so.6", "libdl.so.2", "librt.so.1", + "libc.so.6", "libnsl.so.1", "libutil.so.1", "libpthread.so.0", + "libX11.so.6", "libXext.so.6", "libXrender.so.1", "libICE.so.6", + "libSM.so.6", "libGL.so.1", "libgobject-2.0.so.0", + "libgthread-2.0.so.0", "libglib-2.0.so.0", "libresolv.so.2", + "libexpat.so.1" ]} ] diff --git a/src/auditwheel/policy.rs b/src/auditwheel/policy.rs index 6a608dba0..c3f0a5150 100644 --- a/src/auditwheel/policy.rs +++ b/src/auditwheel/policy.rs @@ -21,6 +21,8 @@ pub static POLICIES: Lazy> = Lazy::new(|| { pub struct Policy { /// manylinux platform tag name pub name: String, + /// manylinux platform tag aliases + pub aliases: Vec, /// policy priority. Tags supporting more platforms have higher priority pub priority: i64, /// platform architecture to symbol versions map @@ -39,7 +41,15 @@ impl Default for Policy { impl Display for Policy { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str(&self.name) + if self.aliases.is_empty() { + f.write_str(&self.name) + } else { + f.write_fmt(format_args!( + "{}(aka {})", + &self.name, + self.aliases.join(",") + )) + } } } @@ -62,7 +72,10 @@ impl Policy { /// Get policy by it's manylinux platform tag name pub fn from_name(name: &str) -> Option { - POLICIES.iter().find(|p| p.name == name).cloned() + POLICIES + .iter() + .find(|p| p.name == name || p.aliases.iter().any(|alias| alias == name)) + .cloned() } /// Get policy by it's priority @@ -77,11 +90,11 @@ mod test { #[test] fn test_load_policy() { - let linux = POLICIES.iter().find(|p| p.name == "linux").unwrap(); + let linux = Policy::from_name("linux").unwrap(); assert!(linux.symbol_versions.is_empty()); assert!(linux.lib_whitelist.is_empty()); - let manylinux2010 = POLICIES.iter().find(|p| p.name == "manylinux2010").unwrap(); + let manylinux2010 = Policy::from_name("manylinux2010").unwrap(); assert!(manylinux2010.lib_whitelist.contains("libc.so.6")); let symbol_version = &manylinux2010.symbol_versions["x86_64"]; assert_eq!(symbol_version["CXXABI"].len(), 4); @@ -97,21 +110,4 @@ mod test { let _tag = policy.manylinux_tag(); } } - - #[test] - fn test_policy_from_name() { - use crate::auditwheel::Manylinux; - - let tags = &[ - Manylinux::Manylinux1, - Manylinux::Manylinux2010, - Manylinux::Manylinux2014, - Manylinux::Manylinux_2_24, - Manylinux::Off, - ]; - for manylinux in tags { - let policy = Policy::from_name(&manylinux.to_string()); - assert!(policy.is_some()); - } - } } diff --git a/src/build_options.rs b/src/build_options.rs index 675af4296..494359b7b 100644 --- a/src/build_options.rs +++ b/src/build_options.rs @@ -20,8 +20,9 @@ use structopt::StructOpt; #[derive(Debug, Serialize, Deserialize, StructOpt, Clone, Eq, PartialEq)] #[serde(default)] pub struct BuildOptions { - /// Control the platform tag on linux. Options are `2010` (for manylinux2010), - /// `2014` (for manylinux2014), `2_24` (for manylinux_2_24) and `off` (for the native linux tag). + /// Control the platform tag on linux. Options are `2010`/`2_12` (for manylinux2010), + /// `2014`/`2_17` (for manylinux2014), `2_24` (for manylinux_2_24), `2_27` (for manylinux_2_27) + /// and `off` (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`. /// @@ -30,7 +31,7 @@ pub struct BuildOptions { /// This option is ignored on all non-linux platforms #[structopt( long, - possible_values = &["2010", "2014", "2_24", "off"], + possible_values = &["2010", "2014", "2_12", "2_17", "2_24", "2_27", "off"], case_insensitive = true, )] pub manylinux: Option, diff --git a/src/target.rs b/src/target.rs index 15afdee5c..f3df17fd9 100644 --- a/src/target.rs +++ b/src/target.rs @@ -194,9 +194,9 @@ impl Target { pub fn get_default_manylinux_tag(&self) -> Manylinux { match self.arch { Arch::Aarch64 | Arch::Armv7L | Arch::Powerpc64 | Arch::Powerpc64Le | Arch::S390X => { - Manylinux::Manylinux2014 + Manylinux::manylinux2014() } - Arch::X86 | Arch::X86_64 => Manylinux::Manylinux2010, + Arch::X86 | Arch::X86_64 => Manylinux::manylinux2010(), } }