Skip to content

Sqlx depend on libsqlite3-sys if sqlite feature is disabled #3556

@LuckyTurtleDev

Description

@LuckyTurtleDev

Bug Description

Sqlx depend on libsqlite3-sys if sqlite feature is disabled.

Minimal Reproduction

❯ mkdir sqlx-test
❯ cd sqlx-test
❯ cargo init

add the following dependecies to the Cargo.toml

matrix-sdk = { version = "0.7.1", default-features = false, features = ["native-tls", "e2e-encryption"], optional = true }
sqlx = { version = "0.8.2", optional = true, default-features = false, features = ["runtime-tokio", "migrate", "postgres", "macros"] }
❯ cargo run
    Updating crates.io index
error: failed to select a version for `libsqlite3-sys`.
    ... required by package `rusqlite v0.30.0`
    ... which satisfies dependency `rusqlite = "^0.30.0"` of package `matrix-sdk-sqlite v0.7.0`
    ... which satisfies dependency `matrix-sdk-sqlite = "^0.7.0"` of package `matrix-sdk v0.7.1`
    ... which satisfies dependency `matrix-sdk = "^0.7.1"` of package `sqlx-test v0.1.0 (/home/lukas/test/sqlx-test)`
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.2`
    ... which satisfies dependency `sqlx-sqlite = "=0.8.2"` of package `sqlx v0.8.2`
    ... which satisfies dependency `sqlx = "^0.8.2"` of package `sqlx-test v0.1.0 (/home/lukas/test/sqlx-test)`
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

Additional Info

Looks like this only happen if the migrate is enabled.

Info

  • SQLx version: 0.8.2
  • SQLx features enabled: "runtime-tokio", "migrate", "postgres", "macros"
  • Database server and version: no idea. do not even get to this stepp
  • Operating system: Arch Linux
  • rustc --version: rustc 1.81.0 (eeb90cda1 2024-09-04)

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