rusqlite icon indicating copy to clipboard operation
rusqlite copied to clipboard

Two crates which depend on the libsqlite3-sys will link error in the same project.

Open lsk569937453 opened this issue 1 year ago • 4 comments

rusqlite = { version = "0.32.1", default-features = false,features = ["bundled-sqlcipher-vendored-openssl"] } sqlx = { version = "0.8.2", features = ["runtime-tokio","tls-native-tls","sqlite"] }

The rusqlite and sqlx depend on the crate of libsqlite3-sys,if I add them in one project ,it will link error.

lsk569937453 avatar Dec 05 '24 07:12 lsk569937453

See #1393 which seems to suggest that both rusqlite and sqlx can coexist. I guess your issue happens because you mix sqlcipher and sqlite.

gwenn avatar Dec 05 '24 18:12 gwenn

i'm seeing this with rusqlite and refinery

[dependencies]
refinery = { version = "0.8.14", features = ["rusqlite"] }
rusqlite = "0.32.1"
error: failed to select a version for `libsqlite3-sys`.
    ... required by package `rusqlite v0.23.0`
    ... which satisfies dependency `rusqlite = ">=0.23, <=0.31"` of package `refinery-core v0.8.14`
    ... which satisfies dependency `refinery-core = "^0.8.14"` of package `refinery v0.8.14`
    ... which satisfies dependency `refinery = "^0.8.14"` of package `repository-sqlite v0.1.0 (/home/dan/Code/rust/stronger/repository-sqlite)`
versions that meet the requirements `^0.18.0` are: 0.18.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 `rusqlite v0.32.1`
    ... which satisfies dependency `rusqlite = "^0.32.1"` of package `repository-sqlite v0.1.0 (/home/dan/Code/rust/stronger/repository-sqlite)`
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.

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

danieleades avatar Jan 12 '25 17:01 danieleades

I have the same issue trying to use both sqlx and rusqlite, a guide on that would be highly appreciated.

AnicetNgrt avatar Jan 21 '25 09:01 AnicetNgrt

There is an explanation here: https://youtu.be/pePqWoTnSmQ?list=PLqbS7AVVErFiWDOAVrPt7aYmnuuOLYvOa&t=1840

gwenn avatar Jan 25 '25 18:01 gwenn