maturin icon indicating copy to clipboard operation
maturin copied to clipboard

Cargo install doesn't work without --locked

Open arielb1 opened this issue 6 months ago • 4 comments

Bug Description

Cargo install doesn't work without --locked due to https://github.com/rust-cross/cargo-xwin/issues/160 - you'll need to update to cargo-xwin 0.19.0

Your maturin version (maturin --version)

1.9.0

Your Python version (python -V)

Python 3.12.10

Your pip version (pip -V)

pip 24.3.1

What bindings you're using

None

Does cargo build work?

  • [ ] Yes, it works

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

  • [ ] Yes

Steps to Reproduce

cargo install maturin does not work

error:

error[E0061]: this function takes 4 arguments but 3 arguments were supplied
   --> /tmp/tmp.6MIQvA7jtp/registry/src/index.crates.io-1949cf8c6b5b557f/cargo-xwin-0.18.6/src/compiler/clang_cl.rs:172:19
    |
172 | ... = xwin::Ctx::with_dir(xwin::PathBuf::from(xwin_dir), draw_target, agent)?;
    |       ^^^^^^^^^^^^^^^^^^^---------------------------------------------------
    |                          |                                            |
    |                          |                                            expected `xwin::ureq::Agent`, found `ureq::Agent`
    |                          argument #4 of type `u8` is missing
    |
note: two different versions of crate `ureq` are being used; two types coming from two different versions of the same crate are different types even if they look the same
    |
   ::: /tmp/tmp.6MIQvA7jtp/registry/src/index.crates.io-1949cf8c6b5b557f/ureq-3.0.12/src/agent.rs:90:1
    |
90  | pub struct Agent {
    | ^^^^^^^^^^^^^^^^ this is the expected type `xwin::ureq::Agent`
   --> /tmp/tmp.6MIQvA7jtp/registry/src/index.crates.io-1949cf8c6b5b557f/ureq-2.12.1/src/agent.rs:112:1
    |
112 | pub struct Agent {
    | ^^^^^^^^^^^^^^^^ this is the found type `ureq::Agent`
    |
   ::: /tmp/tmp.6MIQvA7jtp/registry/src/index.crates.io-1949cf8c6b5b557f/cargo-xwin-0.18.6/src/compiler/clang_cl.rs:14:5
    |
14  | use xwin::util::ProgressTarget;
    |     ---- one version of crate `ureq` used here, as a dependency of crate `xwin`
    |
   ::: /tmp/tmp.6MIQvA7jtp/registry/src/index.crates.io-1949cf8c6b5b557f/cargo-xwin-0.18.6/src/compiler/clang.rs:152:59
    |
152 | ...wnload_url(&self, agent: ureq::Agent) -> Result<String> {
    |                             ---- one version of crate `ureq` used here, as a direct dependency of the current crate
    = help: you can use `cargo tree` to explore your dependency tree
note: associated function defined here
   --> /tmp/tmp.6MIQvA7jtp/registry/src/index.crates.io-1949cf8c6b5b557f/xwin-0.6.6/src/ctx.rs:46:12
    |
46  |     pub fn with_dir(
    |            ^^^^^^^^
help: provide the argument
    |
172 -         let ctx = xwin::Ctx::with_dir(xwin::PathBuf::from(xwin_dir), draw_target, agent)?;
172 +         let ctx = xwin::Ctx::with_dir(xwin::PathBuf::from(xwin_dir), draw_target, /* xwin::ureq::Agent */, /* u8 */)?;
    |

error[E0061]: this function takes 7 arguments but 6 arguments were supplied
   --> /tmp/tmp.6MIQvA7jtp/registry/src/index.crates.io-1949cf8c6b5b557f/cargo-xwin-0.18.6/src/compiler/clang_cl.rs:186:22
    |
186 |         let pruned = xwin::prune_pkg_list(
    |                      ^^^^^^^^^^^^^^^^^^^^
...
191 |             self.xwin_options.xwin_sdk_version.clone(),
    |             ------------------------------------------ argument #5 of type `bool` is missing
    |
note: function defined here
   --> /tmp/tmp.6MIQvA7jtp/registry/src/index.crates.io-1949cf8c6b5b557f/xwin-0.6.6/src/lib.rs:198:8
    |
198 | pub fn prune_pkg_list(
    |        ^^^^^^^^^^^^^^
help: provide the argument
    |
186 -         let pruned = xwin::prune_pkg_list(
   --> /tmp/tmp.6MIQvA7jtp/registry/src/index.crates.io-1949cf8c6b5b557f/xwin-0.6.6/src/ctx.rs:259:12
    |
259 |     pub fn execute(
    |            ^^^^^^^
help: provide the argument
    |
262 -         ctx.execute(
263 -             pkgs,
264 -             work_items,
265 -             pruned.crt_version,
266 -             pruned.sdk_version,
267 -             arches,
268 -             variants,
269 -             op,
270 -         )?;
262 +         ctx.execute(pkgs, work_items, pruned.crt_version, pruned.sdk_version, /* std::option::Option<std::string::String> */, variants, arches, op)?;
    |

For more information about this error, try `rustc --explain E0061`.
error: could not compile `cargo-xwin` (lib) due to 3 previous errors

arielb1 avatar Jun 23 '25 17:06 arielb1

You could add an xwin = "< 0.6.6" dependency and that would also fix things by avoiding picking the bad version.

arielb1 avatar Jun 23 '25 17:06 arielb1

Running into this issue as well.

Neither installing cargo-xwin with --locked nor adding xwin = "< 0.6.6" as a dependency seems to resolve the problem:

error[E0061]: this function takes 4 arguments but 3 arguments were supplied
   --> /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cargo-xwin-0.18.6/src/compiler/clang_cl.rs:172:19
    |
172 |         let ctx = xwin::Ctx::with_dir(xwin::PathBuf::from(xwin_dir), draw_target, agent)?;
    |                   ^^^^^^^^^^^^^^^^^^^---------------------------------------------------
    |                                      |                                            |
    |                                      |                                            expected `xwin::ureq::Agent`, found `ureq::Agent`
    |                                      argument #4 of type `u8` is missing
    |
note: two different versions of crate `ureq` are being used; two types coming from two different versions of the same crate are different types even if they look the same
    |
   ::: /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ureq-3.0.12/src/agent.rs:90:1
    |
90  | pub struct Agent {
    | ^^^^^^^^^^^^^^^^ this is the expected type `xwin::ureq::Agent`
   --> /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ureq-2.12.1/src/agent.rs:112:1
    |
112 | pub struct Agent {
    | ^^^^^^^^^^^^^^^^ this is the found type `ureq::Agent`
    |
   ::: /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cargo-xwin-0.18.6/src/compiler/clang_cl.rs:14:5
    |
14  | use xwin::util::ProgressTarget;
    |     ---- one version of crate `ureq` used here, as a dependency of crate `xwin`
    |
   ::: /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cargo-xwin-0.18.6/src/compiler/clang.rs:152:59
    |
152 |     fn get_latest_msvc_sysroot_download_url(&self, agent: ureq::Agent) -> Result<String> {
    |                                                           ---- one version of crate `ureq` used here, as a direct dependency of the current crate
    = help: you can use `cargo tree` to explore your dependency tree
note: associated function defined here
   --> /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/xwin-0.6.6/src/ctx.rs:46:12
    |
46  |     pub fn with_dir(
    |            ^^^^^^^^
help: provide the argument
    |
172 -         let ctx = xwin::Ctx::with_dir(xwin::PathBuf::from(xwin_dir), draw_target, agent)?;
172 +         let ctx = xwin::Ctx::with_dir(xwin::PathBuf::from(xwin_dir), draw_target, /* xwin::ureq::Agent */, /* u8 */)?;
    |

error[E0061]: this function takes 7 arguments but 6 arguments were supplied
   --> /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cargo-xwin-0.18.6/src/compiler/clang_cl.rs:186:22
    |
186 |         let pruned = xwin::prune_pkg_list(
    |                      ^^^^^^^^^^^^^^^^^^^^
...
191 |             self.xwin_options.xwin_sdk_version.clone(),
    |             ------------------------------------------ argument #5 of type `bool` is missing
    |
note: function defined here
   --> /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/xwin-0.6.6/src/lib.rs:198:8
    |
198 | pub fn prune_pkg_list(
    |        ^^^^^^^^^^^^^^
help: provide the argument
    |
186 -         let pruned = xwin::prune_pkg_list(
187 -             &pkg_manifest,
188 -             arches,
189 -             variants,
190 -             self.xwin_options.xwin_include_atl,
191 -             self.xwin_options.xwin_sdk_version.clone(),
192 -             self.xwin_options.xwin_crt_version.clone(),
193 -         )?;
186 +         let pruned = xwin::prune_pkg_list(&pkg_manifest, arches, variants, self.xwin_options.xwin_include_atl, /* bool */, self.xwin_options.xwin_crt_version.clone(), self.xwin_options.xwin_sdk_version.clone())?;
    |

   Compiling ignore v0.4.23
error[E0061]: this method takes 8 arguments but 7 arguments were supplied
   --> /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cargo-xwin-0.18.6/src/compiler/clang_cl.rs:262:13
    |
262 |         ctx.execute(
    |             ^^^^^^^
...
267 |             arches,
    |             ------ argument #5 of type `std::option::Option<std::string::String>` is missing
    |
note: method defined here
   --> /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/xwin-0.6.6/src/ctx.rs:259:12
    |
259 |     pub fn execute(
    |            ^^^^^^^
help: provide the argument
    |
262 -         ctx.execute(
263 -             pkgs,
264 -             work_items,
265 -             pruned.crt_version,
266 -             pruned.sdk_version,
267 -             arches,
268 -             variants,
269 -             op,
270 -         )?;
262 +         ctx.execute(pkgs, work_items, pruned.crt_version, pruned.sdk_version, /* std::option::Option<std::string::String> */, variants, arches, op)?;
    |

   Compiling cab v0.5.0
For more information about this error, try `rustc --explain E0061`.
   Compiling zip v0.6.6
error: could not compile `cargo-xwin` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...

TheTechromancer avatar Jul 02 '25 16:07 TheTechromancer

i ran into this issue, and : cargo install --git https://github.com/PyO3/maturin.git maturin --locked fixed the issue for me

frett27 avatar Sep 13 '25 09:09 frett27

Encountered the same bug while simply cargo install maturin on my Windows machine. Added --locked to install maturin v1.9.4 successfully.

HeWhoHeWho avatar Oct 01 '25 11:10 HeWhoHeWho

I've asked upstream: https://github.com/Jake-Shadle/xwin/issues/168

On our end, we can avoid this by updating cargo-xwin, but that would increase our MSRV, CC @messense for the MSRV.

konstin avatar Dec 28 '25 23:12 konstin