Skip to content

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

Closed
@BSteffaniak

Description

@BSteffaniak

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions