serde_rusqlite icon indicating copy to clipboard operation
serde_rusqlite copied to clipboard

Build fails when rusqlite/git is used

Open proofrock opened this issue 2 years ago • 2 comments

Hi! Thank you for the library. I have a project that uses rusqlite and serde-rusqlite. If I use:

rusqlite = { version = "~0", features = ["serde_json"] }
serde_rusqlite = "~0"

All is well, but if I use the GIT version of rusqlite...

rusqlite = { git  = "https://github.com/rusqlite/rusqlite", features = ["serde_json"] }
serde_rusqlite = "~0"

It fails. If I remove serde_rusqlite, all is well again. I paste the error below; is there a way to fix this?

Thank you!

G.

error: failed to select a version for `libsqlite3-sys`.
    ... required by package `rusqlite v0.29.0`
    ... which satisfies dependency `rusqlite = "^0.29"` (locked to 0.29.0) of package `serde_rusqlite v0.33.1`
    ... which satisfies dependency `serde_rusqlite = "~0"` (locked to 0.33.1) of package `sqliterg v0.0.0 (/home/devel/sqliterg)`
versions that meet the requirements `^0.26.0` (locked to 0.26.0) are: 0.26.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/rusqlite/rusqlite#6176b11a)`
    ... which satisfies git dependency `libsqlite3-sys` of package `rusqlite v0.29.0 (https://github.com/rusqlite/rusqlite#6176b11a)`
    ... which satisfies git dependency `rusqlite` of package `sqliterg v0.0.0 (/home/devel/sqliterg)`
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
make: *** [Makefile:21: build] Error 101

proofrock avatar Sep 18 '23 15:09 proofrock

Can you please try crate version 0.34?

twistedfall avatar Nov 14 '23 17:11 twistedfall

Hi! Sorry for the delay here. It basically gives the same error:

make build
cargo build --release
    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"` of package `serde_rusqlite v0.34.0`
    ... which satisfies dependency `serde_rusqlite = "^0.34"` of package `sqliterg v0.17.1 (/home/devel/sqliterg)`
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.27.0 (https://github.com/rusqlite/rusqlite#c2fbd167)`
    ... which satisfies git dependency `libsqlite3-sys` (locked to 0.27.0) of package `rusqlite v0.30.0 (https://github.com/rusqlite/rusqlite#c2fbd167)`
    ... which satisfies git dependency `rusqlite` (locked to 0.30.0) of package `sqliterg v0.17.1 (/home/devel/sqliterg)`
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
make: *** [Makefile:36: build] Error 101

I think I see that you updated the dependency, it's a bit of cat-and-mouse game... I don't know rust enough to say if there's a way to say "latest possible version of a dependency"...

Anyway, if you don't mind, I took the relevant code from your project and incorporated in mine, it works like a charm, so thanks. How can I give proper attribution?

https://github.com/proofrock/sqliterg/commit/3fde75e9708cf5a49b425b18c9c098c4abe4fb6b

I also used the same code in a project for DuckDB, it works flawslessly too, if you are interested in porting.

proofrock avatar Dec 03 '23 21:12 proofrock