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
3.93k stars 272 forks source link

v1.7.0 from v1.6.0 introduces a rustls version conflict preventing v.1.7.0 from compiling #2143

Closed EdmundsEcho closed 4 months ago

EdmundsEcho commented 4 months ago

Bug Description

I did not fix my maturin version in a github action that installs maturin. My github action started to fail using maturin v1.7.0 where it was working with v1.6.0. I'm confident it is a maturin issue as my pyo3 code does not depend on rustls (see the error below). I have encountered this version conflict with rustls in other projects so know how it can creep-in to the build process.

In the github action we use: pip install maturin. This is not the case on my desktop where the project compiles using the previous version of maturin.

Finally, I made sure to use a github action that cleared any caches. This might still be an issue. I'll be sure to update the issue when I resolve the issue.

Your maturin version (maturin --version)

1.7.0

Your Python version (python -V)

3.11

Your pip version (pip -V)

unsure (likely not relevant)

What bindings you're using

pyo3

Does cargo build work?

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

Steps to Reproduce

Here is the error.

Compiling cargo-xwin v0.16.5

9 254.5 error[E0308]: mismatched types

9 254.5 --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-xwin-0.16.5/src/common.rs:633:40

9 254.5 |

9 254.5 633 | Ok(builder.tls_config(Arc::new(client_config)).build())

9 254.5 | -------- ^^^^^^^^^^^^^ expected ClientConfig, found a different ClientConfig

9 254.5 | |

9 254.5 | arguments to this function are incorrect

9 254.5 |

9 254.5 = note: ClientConfig and ClientConfig have similar names, but are actually distinct types

9 254.5 note: ClientConfig is defined in crate rustls

9 254.5 --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.22.4/src/client/client_conn.rs:150:1

9 254.5 |

9 254.5 150 | pub struct ClientConfig {

9 254.5 | ^^^^^^^^^^^^^^^^^^^^^^^

9 254.5 note: ClientConfig is defined in crate rustls

9 254.5 --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.23.11/src/client/client_conn.rs:157:1

9 254.5 |

9 254.5 157 | pub struct ClientConfig {

9 254.5 | ^^^^^^^^^^^^^^^^^^^^^^^

9 254.5 = note: perhaps two different versions of crate rustls are being used?

9 254.5 note: associated function defined here

9 254.5 --> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/sync.rs:392:12

9 254.5

9 254.6 For more information about this error, try rustc --explain E0308.

9 254.6 error: could not compile cargo-xwin (lib) due to 1 previous error

9 254.6 warning: build failed, waiting for other jobs to finish...

9 268.0 error: failed to compile maturin v1.7.0, intermediate artifacts can be found at /tmp/cargo-installi9DzHa.

9 268.0 To reuse those artifacts with a future compilation, set the environment variable CARGO_TARGET_DIR to that path.

9 ERROR: process "/bin/sh -c curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh -s -- -y && . $HOME/.cargo/env && cargo install maturin" did not complete successfully: exit code: 101


[ 4/16] RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh -s -- -y && . $HOME/.cargo/env && cargo install maturin: 241.4 Compiling textwrap v0.16.1 lddtree v0.3.5 dialoguer v0.11.0 cargo-zigbuild v0.18.4 cargo-xwin v0.16.5

254.6 error: could not compile cargo-xwin (lib) due to 1 previous error 254.6 warning: build failed, waiting for other jobs to finish... 268.0 error: failed to compile maturin v1.7.0, intermediate artifacts can be found at /tmp/cargo-installi9DzHa. 268.0 To reuse those artifacts with a future compilation, set the environment variable CARGO_TARGET_DIR to that path.

1 warning found (use --debug to expand):

messense commented 4 months ago

Always use cargo install --locked maturin when building from source.