Skip to content
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

Strange unwanted sqlite dependency when using sqlx 'chrono' feature along with rusqlite #3369

Closed
BSteffaniak opened this issue Jul 23, 2024 · 6 comments · Fixed by #3382
Closed
Labels

Comments

@BSteffaniak
Copy link

BSteffaniak commented Jul 23, 2024

Bug Description

SQLx doesn't seem to play nicely with rusqlite even when not using the sqlite feature.

I'd expect to be able to use rusqlite instead of the sqlx 'sqlite' (for various reasons unrelated to whether it is better or not).

Minimal Reproduction

Demonstration:

  1. Clone the repo: https://github.com/BSteffaniak/sqlx-demo
  2. cargo build
  3. Notice that it succeeds
  4. Uncomment the commented out the sqlx dependency version that has the chrono feature enabled in the Cargo.toml
  5. cargo build
  6. Notice that now it fails with an error message resembling the following:

error: failed to select a version for libsqlite3-sys.
... required by package sqlx-sqlite v0.8.0
... which satisfies dependency sqlx-sqlite = "=0.8.0" of package sqlx v0.8.0
... which satisfies dependency sqlx = "^0.8.0" (locked to 0.8.0) of package sqlx-demo v0.1.0 (/home/bsteffaniak/GitHub/Sqlx-demo)
versions that meet the requirements ^0.28.0 are: 0.28.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.0
... which satisfies dependency libsqlite3-sys = "^0.30.0" (locked to 0.30.0) of package rusqlite v0.32.0
... which satisfies dependency rusqlite = "^0.32.0" (locked to 0.32.0) of package sqlx-demo v0.1.0 (/home/bsteffaniak/GitHub/Sqlx-demo)
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

Am I understanding something incorrectly about how nested dependencies should work?

Thanks!

Info

  • SQLx version: 0.8.0
  • SQLx features enabled: "chrono"
  • Database server and version: postgres 0.8.0
  • Operating system: Debian
  • rustc --version: rustc 1.79.0 (129f3b996 2024-06-10)
@abonander
Copy link
Collaborator

#3211

@abonander abonander closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2024
@CommanderStorm
Copy link
Contributor

@abonander actually this issue is about a compilation failiure, so not about the lockfile ^^

@BSteffaniak You are trying to pull in two versions of sqlite which are different:

  • russqlite uses libsqlite3-sys = "^0.30.0"
  • sqlx uses libsqlite3-sys = 0.28.0

=> please use only one sqlite library version either by only using one library (I'd recomend this) or by using a compatible version (russqlite is too new).

@abonander
Copy link
Collaborator

@CommanderStorm the root cause is #3211. OP specified that they don't have the sqlite feature enabled.

@abonander
Copy link
Collaborator

The workaround would be to match up the libsqlite3-sys versions, but that's suggested in the Cargo error.

@BSteffaniak
Copy link
Author

@abonander thank you for the workaround. 👍

@BSteffaniak
Copy link
Author

@abonander Have you considered bumping the libsqlite3-sys version to the most recent 0.30.0?

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

Successfully merging a pull request may close this issue.

3 participants