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

SQLite is being selected as a feature when it shouldn't causing false failed to select version for libsqlite3-sys failure #2964

Closed
matthewgapp opened this issue Jan 3, 2024 · 5 comments
Labels
bug:rust Indicates a bug or regression in Rust bug

Comments

@matthewgapp
Copy link

Bug Description

Running into an error where cargo thinks that sqlx has the sqlite feature enabled when I don't. Looking at the Sqlx's Cargo.toml, enabling chrono, time, uuid shouldn't enable sqlx-sqlite but they do, according to cargo, causing a blocking error on our side. The only workaround at the moment is to fork sqlx and remove references to sqlite as we can't update the dependency in the sqlsync crate.

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"` (locked to 0.7.3) of package `sqlx v0.7.3`
    ... which satisfies dependency `sqlx = "^0.7.3"` (locked to 0.7.3) of package `rust-lang-issue-10801 v0.1.0 (/Users/matthewgapp/code/scratchpad/rust-lang-issue-10801)`
versions that meet the requirements `^0.27.0` (locked to 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.26.0 (https://github.com/trevyn/rusqlite?branch=wasm32-unknown-unknown#463090d3)`
    ... which satisfies git dependency `libsqlite3-sys` of package `sqlsync v0.2.0 (https://github.com/matthewgapp/sqlsync#c34cb11f)`
    ... which satisfies git dependency `sqlsync` of package `rust-lang-issue-10801 v0.1.0 (/Users/matthewgapp/code/scratchpad/rust-lang-issue-10801)`
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 ='libsqlite3-sys' 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

I also commented on an existing cargo bug that might be the root cause: rust-lang/cargo#10801 (comment). Would be great to know if perhaps it's a configuration issue on the SQLx side of things, though.

Minimal Reproduction

The offending cargo toml has these dependencies:

[dependencies]
sqlx = { version = "0.7.3", features = [ "runtime-tokio-rustls", "postgres", "chrono"], default-features = false }
sqlsync =  { git = "https://github.com/matthewgapp/sqlsync" }

Place into a new cargo project and run cargo build to see the error. Alternatively, you can clone this example repo: https://github.com/matthewgapp/rust-lang-issue-10801. You'll be able to reproduce the below error. Note that while the sqlsync crate does depend on sqlite the sqlx crate shouldn't depend on sqlite (note the weak references). But cargo thinks it does.

Info

  • SQLx version: 0.7.3
  • SQLx features enabled: ["runtime-tokio-rustls", "postgres", "chrono"]
  • Database server and version: N/A
  • Operating system: MacOS
  • rustc --version: 1.75
@matthewgapp matthewgapp added the bug label Jan 3, 2024
@joehoyle
Copy link

Also running into this

@tgruben
Copy link

tgruben commented Feb 3, 2024

same here

@QAston
Copy link

QAston commented Mar 7, 2024

same

@palinko91
Copy link

I've run into this also, had to downgrade to:
sqlx = { version = "=0.6.3", features = ["runtime-tokio-native-tls", "sqlite", "chrono"]}
To make it run

@abonander
Copy link
Collaborator

This is unfortunately a Cargo bug as OP has found. Closing in favor of #3211 as an aggregation issue.

@abonander abonander closed this as not planned Won't fix, can't repro, duplicate, stale Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:rust Indicates a bug or regression in Rust bug
Projects
None yet
Development

No branches or pull requests

6 participants