Skip to content

Sui Rust SDK Bug #22336

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

Open
BuFuuu opened this issue Jun 7, 2025 · 4 comments
Open

Sui Rust SDK Bug #22336

BuFuuu opened this issue Jun 7, 2025 · 4 comments

Comments

@BuFuuu
Copy link

BuFuuu commented Jun 7, 2025

Steps to Reproduce Issue

Follow the instructions here to get started with the Rust SDK: https://docs.sui.io/references/rust-sdk
Create a Cargo.toml with:

[package]
name = "test"
version = "0.1.0"
edition = "2021"

[dependencies]
sui_sdk = { git = "https://github.com/mystenlabs/sui", package = "sui-sdk" }
tokio = { version = "1.2", features = ["full"] }
anyhow = "1.0"

Then create a src folder and add the main.rs file as described in https://docs.sui.io/references/rust-sdk.

Then run:
cargo build

Expected Result

It should build the project.

Actual Result

I get this error message:

error: no matching package named `move-core-types` found
location searched: https://github.com/mystenlabs/sui#02ad6773
required by package `sui-sdk v1.51.0 (https://github.com/mystenlabs/sui#02ad6773)`
    ... which satisfies git dependency `sui_sdk` of package `test v0.1.0 (/home/user/SUI-RUST)`

I found this explanation for it:
It failed to find move-core-types because sui-sdk expects it as a local workspace dependency at a specific path (external-crates/move/crates/move-core-types), but when sui-sdk is used as a standalone Git or path dependency outside its original workspace, Cargo cannot resolve workspace-relative paths. Even if the files are present, Cargo looks for move-core-types in your own project’s workspace context, not Sui's, so it fails unless you manually add that dependency or build within the full Sui repo.

When I downloaded the Sui repo manually with git clone and then added the dependency as
sui-sdk = { path = "./sui/crates/sui-sdk" }, it fixed the issue.

System Information

Windows 11 / Ubuntu (tested with both)
cargo 1.87.0-nightly (1d1d646c0 2025-02-21)

Copy link
Contributor

github-actions bot commented Jun 7, 2025

Thank you for opening this issue, a team member will review it shortly. Until then, please do not interact with any users that claim to be from Sui support and do not click on any links!

@gfusee
Copy link
Contributor

gfusee commented Jun 8, 2025

Cargo is able to find crates in a git repo by traversing the file tree: see Cargo's official documentation.

I have multiple Rust projects using the sui-sdk crate, without importing move-core-types. Those compile perfectly. I checked on my Cargo.lock and the version used is the same as yours: 1.51.0

I'm on macOS and I tested with the exact same version of cargo as yours, it compiles.

What you can try:

  • Deleting the Cargo.lock file
  • Deleting the target folder
  • Clear the cache with a command such cargo-cache
  • Run cargo build or cargo update with --verbose to have more detailed details
  • Check your Cargo config file if no unexpected changes have been made

@BuFuuu
Copy link
Author

BuFuuu commented Jun 8, 2025

It works with
use sui_sdk::types::base_types::SuiAddress;

but not with use sui_types::base_types::SuiAddress;

Is this how you did it?

@BuFuuu
Copy link
Author

BuFuuu commented Jun 9, 2025

Furthermore, I encountered an error after cloning https://github.com/MystenLabs/sui.git and attempting to run cargo run --example coin_read_api from the root directory. The error message is as follows:

error: failed to run custom build command for 'librocksdb-sys v0.16.0+8.10.0'
Unable to find libclang: "couldn't find any valid shared libraries matching: ['clang.dll', 'libclang.dll'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"

As someone who is not an experienced Rust developer, I expected basic examples like this to run more smoothly. It would be helpful if these examples worked out of the box without requiring additional system setup or native dependencies.

I am being this verbose to provide insight into how a less experienced developer approaches this (I saw that Sam Blackshear asked developers for feedback on what could be improved).
My overall goal was to create sponsored transactions. When I tried it with Python and the JSON-RPC API, it didn’t work. I also had a lot of trouble with Rust and the sui_sdk.
I just tried TypeScript in the last hour, and it worked very quickly. I’m sticking with this now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants