Example-helloworld building

Hello, everyone.
I will appreciate it if you help me with this error.
I just installed a rust environment on the windows subsystem and was going to build an example-helloworld project as a guide.
There is an error ongoing.


Regards.
from Panda5

Can you provide a link to this project?

Yes, sure.

And the tutorial link: Solana Tutorial | Building Smart Contracts & dApps For The Solana Hackathon

Why are you using npm to run cargo. Wouldnt it be easier to use cargo directly?

I don't know well.
I only followed the tutorial.
But "cargo check" is also not working.

That is not any tutorial on a "Hello World" program in Rust.

It's about using Rust from Javascript and specifically with some "block chain" system. Whatever that is.

I suggest that before you get into such advanced topics with Rust you start with what is commonly called the "Rust Book": The Rust Programming Language - The Rust Programming Language

There you will find that a Rust "Hello World" program is what you get out of the box when starting a new program with the Cargo tool. I'm sure that will compile just fine.

When you have studied the book a bit you will be ready for using Rust from some other language, like Javascript, and doing whatever with it, like block chain.

3 Likes

Ok, I will check and reply soon.

Thanks for your help.
But I have to solve this problem, because it is not working on windows.
I tried this on window, but this is saying like this.
"Solana Rust BPF toolchain is not available on Windows"

I guess that means that means that the Solana Rust BPF toolchain is not available on Windows. So you are out of luck.

I also guess this is a question for the Solana guys. See " Further questions? Visit us on Discord" in the README of the Solana repository you linked us to above.

I highly recommand you to first learn how to use Rust alone, and then with JavaScript or whatever system you need to interact with.

If you create a simple project with cargo new <your-project-name>, go into the created directoy and run cargo run, your application should display a hello world message :slight_smile:

You can test that to ensure Rust is correctly installed on your system.


I did, so testRust project was created.
But it has still error.
What is the problem ?

cargo new creates a new project inside a new directory. You then need to move into that directory : testRust.

Thanks.
Now cargo is working well.
Then what is the problem of the previous "example-helloword" project error?

No idea. Some build script obviously expects to be able to open a .crates.toml file which somehow you don't have permission to open. I'd first check to see if the file exists, if it does what its permission bits are, ensure I'm able to read it and try again.

I've no idea what the cargo-build-bpf tool is, it seems to be some custom build tool the Solana team made.

Frankly you should ask your questions to the Solana team.

@erelde, thanks for your reply.
Sorry, but do you know about Solona smart Contract ?

No. And I very much don't want to have anything to do with anything "blockchain", "smart" contracts and such.

I'm happy to help about Rust or cargo specific issues though.