Skip to content

Conflict between native dependencies only enabled for targets we don’t care about #10099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sebcrozet opened this issue Nov 19, 2021 · 1 comment
Labels
C-bug Category: bug

Comments

@sebcrozet
Copy link

Problem

As part of the same application, I have been trying to use both wgpu 0.9 (for rendering only) and wgpu 0.11 (for compute only). However, it appears that adding both wgpu 0.9 and wgpu 0.11 dependencies yields a Cargo error:

Execution failed (exit code 101).
C:/Users/devel/.cargo/bin/cargo.exe metadata --verbose --format-version 1 --all-features
stdout :     Updating crates.io index
error: failed to select a version for `web-sys`.
    ... required by package `wgpu v0.11.0`
    ... which satisfies dependency `wgpu11 = "^0.11"` of package `wgpu_test v0.1.0 (C:\Users\devel\work\trash\wgpu-test)`
versions that meet the requirements `^0.3.53` are: 0.3.55, 0.3.54, 0.3.53

all possible versions conflict with previously selected packages.

  previously selected package `web-sys v0.3.50`
    ... which satisfies dependency `web-sys = "=0.3.50"` of package `wgpu v0.9.0`
    ... which satisfies dependency `wgpu = "^0.9"` of package `wgpu_test v0.1.0 (C:\Users\devel\work\trash\wgpu-test)`

failed to select a version for `web-sys` which could resolve this conflict

I understand that this is caused by the fact that we depend on two different versions of the same native library, which could cause link issues (and I guess that’s why we have a links entry on that Cargo.toml on the wasm-bindgen project). However, that web-sys dependency should be enabled only when targeting WASM:

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2.76" # remember to change version in wiki as well
web-sys = { version = "0.3.53", features = [

In my case I’m only targeting native platforms and am OK having the web target fail to compile.

Is there a way not to have this dependency conflict for native dependencies that are not enabled for the platform I’m targetting?

Steps

  1. cargo new wgpu_test
  2. Copy the following Cargo.toml file:
[package]
name = "wgpu_test"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
wgpu = "0.9"
wgpu11 = { package = "wgpu", version = "0.11" }
  1. cargo check will fail.

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.58.0-nightly (94ca096af 2021-10-29)
release: 1.58.0
commit-hash: 94ca096afbf25f670e76e07dca754fcfe27134be
commit-date: 2021-10-29
host: x86_64-pc-windows-msvc
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.79.1-DEV (sys:0.4.49+curl-7.79.1 vendored ssl:Schannel)
os: Windows 10.0.22000 (Windows 10 Pro) [64-bit]
@sebcrozet sebcrozet added the C-bug Category: bug label Nov 19, 2021
@sebcrozet sebcrozet changed the title Conflict between native dependencies only enabled for targets we don’t target Conflict between native dependencies only enabled for targets we don’t care about Nov 19, 2021
@ehuss
Copy link
Contributor

ehuss commented Nov 19, 2021

Thanks for the report! This is essentially a duplicate of #5969, so closing in favor of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants