refinery icon indicating copy to clipboard operation
refinery copied to clipboard

Support rusqlite v0.34.x

Open jfhbrook opened this issue 8 months ago • 7 comments

I have a Cargo.toml that looks like this:

[package]
name = "nopkg"
version = "0.1.0"
edition = "2024"

[dependencies]
anyhow = "1.0.97"
camino = "1.1.9"
clap = { version = "4.5.32", features = ["derive"] }
clap_complete = "4.5.46"
config = "0.15.9"
futures-util = "0.3.31"
indicatif = "0.17.11"
reqwest = { version = "0.12.14", features = ["stream"] }
rusqlite = { version = "0.34.0", features = ["bundled"] }
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
sha3 = "0.10.8"
thiserror = "2.0.12"
tokio = { version = "1.44.1", features = ["full"] }
toml = "0.8.20"
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.19", features = ["json"] }
url = "2.5.4"
xdg = "2.5.2"

I'm using rusqlite with the "bundled" feature, hoping to avoid a reliance on a system library.

But then I go to add refinery with the rusqlite feature, and it explodes:

$ cargo add refinery --features rusqlite        
    Updating crates.io index
      Adding refinery v0.8.16 to dependencies
             Features:
             + rusqlite
             + toml
             - enums
             - mysql
             - mysql_async
             - postgres
             - rusqlite-bundled
             - serde
             - tiberius
             - tiberius-config
             - tokio-postgres
    Updating crates.io index
error: failed to select a version for `libsqlite3-sys`.
    ... required by package `rusqlite v0.23.0`
    ... which satisfies dependency `rusqlite = ">=0.23, <=0.33"` of package `refinery-core v0.8.16`
    ... which satisfies dependency `refinery-core = "^0.8.16"` (locked to 0.8.16) of package `refinery v0.8.16`
    ... which satisfies dependency `refinery = "^0.8.16"` (locked to 0.8.16) of package `nopkg v0.1.0 (/Users/josh/code/jfhbrook/public/nopkg)`
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.32.0`
    ... which satisfies dependency `libsqlite3-sys = "^0.32.0"` (locked to 0.32.0) of package `rusqlite v0.34.0`
    ... which satisfies dependency `rusqlite = "^0.34.0"` (locked to 0.34.0) of package `nopkg v0.1.0 (/Users/josh/code/jfhbrook/public/nopkg)`
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

I tried with the rusqlite-bundled feature as well, but I get a very similar error:

cargo add refinery --features rusqlite-bundled
    Updating crates.io index
      Adding refinery v0.8.16 to dependencies
             Features:
             + rusqlite
             + rusqlite-bundled
             + toml
             - enums
             - mysql
             - mysql_async
             - postgres
             - serde
             - tiberius
             - tiberius-config
             - tokio-postgres
    Updating crates.io index
error: failed to select a version for `libsqlite3-sys`.
    ... required by package `rusqlite v0.23.0`
    ... which satisfies dependency `rusqlite = ">=0.23, <=0.33"` of package `refinery-core v0.8.16`
    ... which satisfies dependency `refinery-core = "^0.8.16"` (locked to 0.8.16) of package `refinery v0.8.16`
    ... which satisfies dependency `refinery = "^0.8.16"` (locked to 0.8.16) of package `nopkg v0.1.0 (/Users/josh/code/jfhbrook/public/nopkg)`
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.32.0`
    ... which satisfies dependency `libsqlite3-sys = "^0.32.0"` (locked to 0.32.0) of package `rusqlite v0.34.0`
    ... which satisfies dependency `rusqlite = "^0.34.0"` (locked to 0.34.0) of package `nopkg v0.1.0 (/Users/josh/code/jfhbrook/public/nopkg)`
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

I'm not sure if I'm doing something wrong, or if the bundled feature isn't supported, and I don't really know how to move forward. Any ideas?

jfhbrook avatar Mar 14 '25 02:03 jfhbrook

I read the stack a little closer, and it seems downgrading to rusqlite 0.33 fixes it. Does this mean rusqlite shipped a new version that now needs to be explicitly supported?

jfhbrook avatar Mar 14 '25 02:03 jfhbrook

Hi @jfhbrook and thanks for the interest :) Yeah exactly, refinery supports up to [0.33](https://github.com/rust-db/refinery/blob/main/refinery_core/Cargo.toml#L32) if you want to submit a PR addressing that I can then cut a new patch version, see previous PR's on how you can do it

jxs avatar Mar 14 '25 21:03 jxs

If it's just a matter of a bump, I can probably PR that during upcoming vacation. But I'm guessing the pinned upper bound is due to concern over breaking changes. Is there existing code that feature flags based on rusqlite version? Or would you drop support for earlier versions if the API changed?

jfhbrook avatar Mar 14 '25 21:03 jfhbrook

My skill level with rust is "enough to be dangerous" - I can follow examples pretty well, but I'm dead in the water as soon as there's a lifetime related error 😉

jfhbrook avatar Mar 14 '25 21:03 jfhbrook

you don't need to touch Rust code, it's just a change on Cargo.toml, see https://github.com/rust-db/refinery/pull/361

jxs avatar Mar 15 '25 17:03 jxs

PR made. I ran the same tests as CI locally, and they seem happy.

jfhbrook avatar Mar 17 '25 19:03 jfhbrook

Hi, when is this supposed to be released? I see PR is merged. This old version is currently breaking rusqlite 0.34.x

boxdox avatar Apr 18 '25 08:04 boxdox

It's been a while, would be great to see this land in a new release please 👍 Using patch.crates-io for now.

tmpfs avatar Sep 23 '25 04:09 tmpfs

Hi all, and sorry for the delay, this has been addressed on https://github.com/rust-db/refinery/pull/402 0.9.0 has been released

jxs avatar Oct 14 '25 13:10 jxs