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

Following the Rust tutorial does not lead to the expected outcome #34443

Open
marctrem opened this issue Dec 13, 2023 · 6 comments
Open

Following the Rust tutorial does not lead to the expected outcome #34443

marctrem opened this issue Dec 13, 2023 · 6 comments
Labels
community Community contribution

Comments

@marctrem
Copy link

Problem

Following the tutorial at [0] does not lead to the expected output. The build succeeds but there is no output artifact.
This has been reproduced on both Linux 6.6.3 and MacOS Sonoma.

[0] https://docs.solana.com/getstarted/rust

There is only one shared object in the directory after building and it's not the one I'm expecting.

find . -name '*.so'
./target/sbf-solana-solana/release/deps/solana_program-f64cfaccf3f3bee1.so

MacOS

solana -V
solana-cli 1.17.9 (src:daf37308; feat:1428472342, client:SolanaLabs)
uname -a
Darwin user-MBP 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct  9 21:33:00 PDT 2023; root:xnu-10002.41.9~7/RELEASE_ARM64_T6031 arm64
rustup run solana rustc -V
rustc 1.68.0-dev

Linux

solana -V
solana-cli 1.17.9 (src:daf37308; feat:1428472342, client:SolanaLabs)
uname -a
Linux jormungandr 6.6.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 29 Nov 2023 00:37:40 +0000 x86_64 GNU/Linux
rustup run solana rustc -V
rustc 1.68.0-dev

Expected behavior

I expect to have a deployable contract after following the tutorial steps.

@marctrem marctrem added the community Community contribution label Dec 13, 2023
@marctrem
Copy link
Author

Here is the build log:

hello_world git:(master) ✗ cargo-build-sbf
warning: unused manifest key: package.crate-type
    Finished release [optimized] target(s) in 0.07s

@marctrem marctrem changed the title Following the Following the Rust tutorial does not lead to the expected outcome Dec 13, 2023
@marctrem
Copy link
Author

Also, worth noting (I might open another issue / PR for this), the sdk/c readme is also very broken. At least I was able to get this one to work.

@deejay-rites
Copy link

deejay-rites commented Mar 8, 2024

I'm also having this same issue using Mac Sonoma 14.3.1.

~/code main*
❯ find . -name '*.so'
./target/sbf-solana-solana/release/deps/solana_program-3cc2c3fefcd81560.so

~/code main*
❯ solana -V
solana-cli 1.17.25 (src:d0ed878d; feat:3580551090, client:SolanaLabs)

~/code main*
❯ uname -a
Darwin name-MacBook-Pro.local 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000 arm64

~/code main*
❯ rustup run solana rustc -V
rustc 1.68.0-dev

~/code main*
❯ cargo build-bpf
warning: unused manifest key: build
warning: unused manifest key: package.crate-type
    Finished release [optimized] target(s) in 0.37s

~/code main*
❯ cat Cargo.toml
[package]
name = "solana"
version = "0.1.0"
edition = "2021"
crate-type = ["cdylib", "lib"]

[dependencies]
solana-program = "=1.17.0"
ahash = "=0.8.6"

[build]
target = "x86_64-apple-darwin"

@deejay-rites
Copy link

Want to follow up that I was able to get this to work using Ubuntu.

will@desktop:/home/will/code/hello_world> ls target/deploy
hello_world-keypair.json  hello_world.so
will@desktop:/home/will/code/hello_world> solana program deploy ./target/deploy/hello_world.so

Program Id: 7Lg34cSpkiLPTRWQoC9yRrf14yTnANvk9Dc6ajocvx7Y

will@desktop:/home/will/code/hello_world> uname -a
Linux desktop 5.15.0-100-generic #110-Ubuntu SMP Wed Feb 7 13:27:48 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

@urani-engineering-helper

@marctrem There a few extra steps to make it work and you should use cargo build-sbf instead of cargo build-bft, as the former is deprecated.

We wrote a working tutorial here https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/01_hello_world. Enjoy.

@JuinSoft
Copy link

JuinSoft commented Apr 20, 2024

@urani-engineering The provided link is broken
Updated link: https://github.com/urani-labs/solana-dev-onboarding-rs/tree/main/demos/backend/01_hello_world

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

No branches or pull requests

4 participants