You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is similar to #7880 but even worse, because the native libraries should never be in the dependency graph at all as they are only selected for optional features, which are not enabled. In the example below with no default features and sqlite not in the feature list the sqlite native library is not part of either binary but still causes a conflict.
Steps
Workspace Cargo.toml
[workspace]
members = ["bin1", "bin2"]
resolver = "2"
bin1 Cargo toml
[package]
name = "bin1"
version = "0.1.0"
edition = "2021"
[dependencies]
sqlx = { version = "0.8.1", features = ["time"], default-features = false }
bin2 Cargo.toml
[package]
name = "bin2"
version = "0.1.0"
edition = "2021"
[dependencies]
sqlx = { version = "0.7.3", features = ["time"], default-features = false }
This causes:
error: failed to select a version for `libsqlite3-sys`.
... required by package `sqlx-sqlite v0.7.3`
... which satisfies dependency `sqlx-sqlite = "=0.7.3"` of package `sqlx v0.7.3`
... which satisfies dependency `sqlx = "^0.7.3"` of package `bin2 v0.1.0 (/Users/hans/dev/spikes/sqlx-sqlite-test/bin2)`
versions that meet the requirements `^0.27.0` are: 0.27.0
the package `libsqlite3-sys` links to the native library `sqlite3`, but it conflicts with a previous package which links to `sqlite3` as well:
package `libsqlite3-sys v0.30.1`
... which satisfies dependency `libsqlite3-sys = "^0.30.1"` of package `sqlx-sqlite v0.8.1`
... which satisfies dependency `sqlx-sqlite = "=0.8.1"` of package `sqlx v0.8.1`
... which satisfies dependency `sqlx = "^0.8.1"` of package `bin1 v0.1.0 (/Users/hans/dev/spikes/sqlx-sqlite-test/bin1)`
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the `links = "sqlite3"` value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.
Please note that at least one (non-sqlite) feature has to be selected for sqlx otherwise the bug does not occur.
Problem
This is similar to #7880 but even worse, because the native libraries should never be in the dependency graph at all as they are only selected for optional features, which are not enabled. In the example below with no default features and sqlite not in the feature list the sqlite native library is not part of either binary but still causes a conflict.
Steps
Workspace Cargo.toml
bin1 Cargo toml
bin2 Cargo.toml
This causes:
Please note that at least one (non-sqlite) feature has to be selected for
sqlx
otherwise the bug does not occur.Version
cargo 1.82.0-nightly (8f40fc5 2024-08-21)
The text was updated successfully, but these errors were encountered: