sui
sui copied to clipboard
libsqlite3-sys version conflict in Rust SDK
Steps to Reproduce Issue
Follow this tutorial, add the sui-sdk crate in Cargo.toml file
[dependencies]
sui-sdk = { git = "https://github.com/MystenLabs/sui", branch = "devnet" }
Then run example code.
use std::str::FromStr;
use sui_sdk::types::base_types::SuiAddress;
use sui_sdk::SuiClient;
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
let sui = SuiClient::new_rpc_client("https://fullnode.devnet.sui.io:443", None).await?;
let address = SuiAddress::from_str("0xec11cad080d0496a53bafcea629fcbcfff2a9866")?;
let objects = sui.read_api().get_objects_owned_by_address(address).await?;
println!("{:?}", objects);
Ok(())
}
Compile Error
error: failed to select a version for `libsqlite3-sys`.
... required by package `sqlx-core v0.6.2 (https://github.com/huitseeker/sqlx?branch=update_libsqlite3#fa4613e7)`
... which satisfies git dependency `sqlx-core` of package `sqlx v0.6.2 (https://github.com/huitseeker/sqlx?branch=update_libsqlite3#fa4613e7)`
... which satisfies git dependency `sqlx` of package `workspace-hack v0.1.0 (https://github.com/MystenLabs/sui?branch=devnet#0bc7d198)`
... which satisfies git dependency `workspace-hack` of package `narwhal-config v0.1.0 (https://github.com/MystenLabs/sui?branch=devnet#0bc7d198)`
... which satisfies git dependency `config` of package `narwhal-consensus v0.1.0 (https://github.com/MystenLabs/sui?branch=devnet#0bc7d198)`
... which satisfies git dependency `consensus` of package `narwhal-executor v0.1.0 (https://github.com/MystenLabs/sui?branch=devnet#0bc7d198)`
... which satisfies git dependency `executor` of package `narwhal-node v0.1.0 (https://github.com/MystenLabs/sui?branch=devnet#0bc7d198)`
... which satisfies git dependency `narwhal-node` of package `sui-core v0.14.1 (https://github.com/MystenLabs/sui?branch=devnet#0bc7d198)`
... which satisfies git dependency `sui-core` of package `sui-cost v0.1.0 (https://github.com/MystenLabs/sui?branch=devnet#0bc7d198)`
... which satisfies git dependency `sui-cost` of package `sui-json-rpc v0.0.0 (https://github.com/MystenLabs/sui?branch=devnet#0bc7d198)`
... which satisfies git dependency `sui-json-rpc` of package `sui-sdk v0.14.1 (https://github.com/MystenLabs/sui?branch=devnet#0bc7d198)`
... which satisfies git dependency `sui-sdk` of package `rustctf-6 v0.1.0 (/Users/xxx/Code/rustctf-6)`
versions that meet the requirements `^0.25.1` are: 0.25.2, 0.25.1
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.24.2`
... which satisfies dependency `libsqlite3-sys = "^0.24.2"` of package `rustctf-6 v0.1.0 (/Users/xxx/Code/rustctf-6)`
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
System Information
- OS: <specify OS version>
macOS Ventura
version 13.0
chip Apple M2
- Compiler:
info: syncing channel updates for 'stable-aarch64-apple-darwin'
info: syncing channel updates for 'nightly-aarch64-apple-darwin'
info: checking for self-updates
stable-aarch64-apple-darwin unchanged - rustc 1.65.0 (897e37553 2022-11-02)
nightly-aarch64-apple-darwin unchanged - rustc 1.67.0-nightly (1286ee23e 2022-11-05)
info: cleaning up downloads & tmp directories
cargo 1.65.0 (4bc8f24d3 2022-10-20)
- Package:
sui v0.14.1 (https://github.com/MystenLabs/sui.git?branch=devnet#0bc7d198)
sui-node v0.14.1 (https://github.com/MystenLabs/sui.git?branch=devnet#0bc7d198)
Yeah, I'm also facing the same issue.
[dependencies] sui-sdk = { git = "https://github.com/MystenLabs/sui" }
macOS Monterey
version 12.6 (21G115)
chip Intel Core i7
error: failed to select a version for `libsqlite3-sys`.
... required by package `sqlx-core v0.6.0`
... which satisfies dependency `sqlx-core = "^0.6.0"` of package `sqlx v0.6.0`
... which satisfies dependency `sqlx = "^0.6"` of package `sui-storage v0.1.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `sui-storage` of package `sui-core v0.15.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `sui-core` of package `sui-cost v0.1.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `sui-cost` of package `sui-json-rpc v0.0.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `sui-json-rpc` of package `sui-sdk v0.15.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `sui-sdk` of package `movectf-5-sln v0.1.0 (/Volumes/dev/project/web3/sui/movectf/movectf-5-sln)`
versions that meet the requirements `^0.24.1` are: 0.24.2, 0.24.1
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.25.1`
... which satisfies dependency `libsqlite3-sys = "^0.25.1"` of package `sqlx-core v0.6.2 (https://github.com/huitseeker/sqlx?branch=update_libsqlite3#fa4613e7)`
... which satisfies git dependency `sqlx-core` of package `sqlx v0.6.2 (https://github.com/huitseeker/sqlx?branch=update_libsqlite3#fa4613e7)`
... which satisfies git dependency `sqlx` of package `workspace-hack v0.1.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `workspace-hack` of package `narwhal-config v0.1.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `config` of package `narwhal-consensus v0.1.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `consensus` of package `narwhal-executor v0.1.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `executor` of package `narwhal-node v0.1.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `narwhal-node` of package `sui-core v0.15.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `sui-core` of package `sui-cost v0.1.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `sui-cost` of package `sui-json-rpc v0.0.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `sui-json-rpc` of package `sui-sdk v0.15.0 (https://github.com/MystenLabs/sui#2210e5f6)`
... which satisfies git dependency `sui-sdk` of package `movectf-5-sln v0.1.0 (/Volumes/dev/project/web3/sui/movectf/movectf-5-sln)`
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
Hey @stella3d, got a couple more reports of this issue -- this is going to be blocking anyone that uses the Rust SDK, so fairly urgent -- adding some tags to reflect that.
Another observation from a report on Discord is that it seems to work fine if the Rust SDK is built from source, rather than pulled from crates.io, so this may be a matter of us needing to update our release on crates.
Is this the commit that's causing all the pain? https://github.com/huitseeker/sqlx/commit/fa4613e770a82a606b2cbaa4d36e3ca628c67dad
This seems to fix the issue
index dd5dee1ab..c808758db 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -111,4 +111,4 @@ workspace-hack = { path = "crates/workspace-hack" }
# patch sqlx to a version using libsqlite3-sys v0.25.1 or later, see
# https://github.com/launchbadge/sqlx/pull/2176
[patch.crates-io]
-sqlx = { git="https://github.com/huitseeker/sqlx", branch="update_libsqlite3" }
+sqlx = { git="https://github.com/huitseeker/sqlx", rev="8fca76065a3a0c46989a4366875aa9b663703001" }
So how should I solve this problem?
The fix has hit devnet branch and I have just confirmed that it's possible to build and run examples using the Rust SDK -- thanks again for your patience everyone!