PyO3 / maturin

Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages
https://maturin.rs
Apache License 2.0
4.01k stars 274 forks source link

With PyO3 version 0.13.1 maturin only builds for CPython 3.6m #411

Closed Genarito closed 3 years ago

Genarito commented 3 years ago

Please provide the following information:

Please list the exact steps required to reproduce your error with all command output and if possible with a repository:

You can check the bug easily with my repo running the first command listed in Build for Python (uses Maturin) section in the repo's README:

  1. Clone the repo
  2. Run the building script and check it compiles for all the Python 3.x versions: docker run --rm -v $(pwd):/io jwaresolutions/ggca-build maturin build --skip-auditwheel --manylinux=2014
  3. Now change the Cargo.toml to use version 0.13.1:
[dependencies.pyo3]
version = "0.13.1"
features = ["auto-initialize"]

Now try to compile again and check that it's only building for CPython3.6m

konstin commented 3 years ago

Could you provide maturin's output?

Genarito commented 3 years ago

Sure!

docker run --rm -v $(pwd):/io jwaresolutions/ggca-build maturin build --skip-auditwheel --manylinux=2014
🔗 Found pyo3 bindings with abi3 support
   Compiling libc v0.2.80
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.48
   Compiling autocfg v1.0.1
   Compiling serde v1.0.117
   Compiling cfg-if v1.0.0
   Compiling getrandom v0.1.15
   Compiling cfg-if v0.1.10
   Compiling lazy_static v1.4.0
   Compiling ryu v1.0.5
   Compiling scopeguard v1.1.0
   Compiling ppv-lite86 v0.2.10
   Compiling serde_derive v1.0.117
   Compiling itoa v0.4.6
   Compiling bitflags v1.2.1
   Compiling serde_json v1.0.60
   Compiling const_fn v0.4.4
   Compiling proc-macro-hack v0.5.19
   Compiling version_check v0.9.2
   Compiling semver-parser v0.7.0
   Compiling pulldown-cmark v0.2.0
   Compiling byteorder v1.3.4
   Compiling memchr v2.3.4
   Compiling rayon-core v1.9.0
   Compiling remove_dir_all v0.5.3
   Compiling same-file v1.0.6
   Compiling bytecount v0.6.2
   Compiling glob v0.3.0
   Compiling pkg-config v0.3.19
   Compiling unindent v0.1.7
   Compiling inventory v0.1.9
   Compiling smallvec v1.5.1
   Compiling either v1.6.1
   Compiling pyo3 v0.13.2
   Compiling paste v1.0.3
   Compiling fast-float v0.2.0
   Compiling kendalls v0.1.5
   Compiling instant v0.1.9
   Compiling crossbeam-utils v0.8.1
   Compiling memoffset v0.6.1
   Compiling rayon v1.5.0
   Compiling lock_api v0.4.2
   Compiling error-chain v0.12.4
   Compiling walkdir v2.3.1
   Compiling itertools v0.9.0
   Compiling GSL-sys v2.0.1
   Compiling quote v1.0.7
   Compiling num_cpus v1.13.0
   Compiling parking_lot_core v0.8.1
   Compiling csv-core v0.1.10
   Compiling regex-automata v0.1.9
   Compiling crossbeam-channel v0.5.0
   Compiling paste-impl v0.1.18
   Compiling rand_core v0.5.1
   Compiling parking_lot v0.11.1
   Compiling crossbeam-epoch v0.9.1
   Compiling semver v0.9.0
   Compiling bstr v0.2.14
   Compiling bincode v1.3.1
   Compiling GSL v2.0.1
   Compiling rand_chacha v0.2.2
   Compiling crossbeam-deque v0.8.0
   Compiling paste v0.1.18
   Compiling csv v1.1.4
   Compiling rand v0.7.3
   Compiling pyo3-macros-backend v0.13.2
   Compiling tempfile v3.1.0
   Compiling inventory-impl v0.1.9
   Compiling indoc-impl v0.3.6
   Compiling ctor v0.1.16
   Compiling ghost v0.1.2
   Compiling pyo3-macros v0.13.2
   Compiling indoc v0.3.6
   Compiling cargo_metadata v0.10.0
   Compiling skeptic v0.13.5
   Compiling extsort v0.4.2
   Compiling ggca v0.2.1 (/io)
warning: field is never read: `n`
   --> src/correlation.rs:129:5
    |
129 |     n: usize
    |     ^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

    Finished dev [unoptimized + debuginfo] target(s) in 1m 14s
📦 Built wheel for CPython 3.6m to /io/target/wheels/ggca-0.2.1-cp36-abi3-manylinux2014_x86_64.whl

Same output with --release parameter

konstin commented 3 years ago

Apparently maturin is building an abi3 wheel, which doesn't use any python interpreter when building and works on any python version from 3.6 onwards. This is strange since in your repository abi3 isn't used. It might be that your dockerfile is using an old prerelease version of maturin - Could you try to rebuilding the docker image and check if it still sees a abi3 where there is none?

Genarito commented 3 years ago

Updating my Dockerfile to use konstin2/maturin:v0.9.4 image make it work perfectly and now It compiles for all Python versions! Thank you so much for your time and predisposition