当前位置:网站首页>156 rust and Solana environment configuration

156 rust and Solana environment configuration

2022-06-21 06:39:00 Lich Howger

Let's talk about rust and solana Environment configuration

Why should I repeat rust and solana Environment configuration

Because I bought a new computer two days ago

Now we need to do something about the environment

So I'll keep a record of the environment

Ha ha ha

Next one first rust

And then install it

then rustc --version

Look at the version

Look again. cargo edition

cargo --version

And then we use cargo Try to create a project

cargo new my_cargo_test

Then let's run

cargo run

I found the wrong report

D:\Project\rust\lich_cargo_test>cargo run
   Compiling lich_cargo_test v0.1.0 (D:\Project\rust\lich_cargo_test)
error: linker `link.exe` not found
  |
  = note: program not found

note: the msvc targets depend on the msvc linker but `link.exe` was not found

note: please ensure that VS 2013, VS 2015, VS 2017, VS 2019 or VS 2022 was installed with the Visual C++ option

error: could not compile `lich_cargo_test` due to previous error

link.exe not found

This is because we didn't install c++ Running environment

But install gccg++ The environment is a little troublesome

I won't pretend

And in the back windows Run up solana It's not convenient

Let's do it another way

Just use wsl

Now let's install it wsl

Let's refer to this document

Install Ubuntu on WSL2 on Windows 10 | UbuntuUbuntu is an open source software operating system that runs from the desktop, to the cloud, to all your internet connected things.https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-10#1-overview Follow the process step by step

We open it as an administrator powershell

then

wsl --install

Wrong report here

PS C:\Windows\system32> wsl --install
wsl :  Cannot be “wsl” Item identified as  cmdlet、 function 、 The name of the script file or runnable program . Please check the spelling of the name 
 Write , If the path is included , Please make sure the path is correct , then try again .
 The position of   That's ok :1  character : 1
+ wsl --install
+ ~~~
    + CategoryInfo          : ObjectNotFound: (wsl:String) [], CommandNotFoundExcept
   ion
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Windows\system32>

We open the control panel

Turn on or off windows function

Or you can search directly to find

then

We enable this

Apply to linux Of windows Subsystem

If you are in a checked state , Just cancel , Restart

Then open it again , Restart again

Then our administrator runs powershell

wsl --install

Or we turn on microsoft store

Search for ubuntu Direct installation

Now we are ubuntu Put it inside rust

wsl

sudo curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Installation successful

Then let's install it gccg++ Environmental Science

sudo apt update

Update and install

sudo apt install build-essential
 

It is really very slow very slow very slow very slow very slow very slow very slow

But I don't know how to solve it

in apt There will be other problems if the image of

Hey, I'm so annoyed

It's finished

Run it

cargo run

[email protected]:/mnt/d/Project/rust/lich_cargo_test$ cargo run
   Compiling lich_cargo_test v0.1.0 (/mnt/d/Project/rust/lich_cargo_test)
    Finished dev [unoptimized + debuginfo] target(s) in 0.58s
     Running `target/debug/lich_cargo_test`
Hello, world!

​

Then we'll install solana cli

sh -c "$(curl -sSfL https://release.solana.com/v1.10.24/install)"

Or download the compressed package directly

https://github.com/solana-labs/solana/releases/tag/v1.10.24

I downloaded it to windows Local

Then copy it to wsl

cp /mnt/d/solanaxxxxx ./

And unzip it

tar jxf solana-release-x86_64-unknown-linux-gnu.tar.bz2

And then configure it ln

sudo ln -s /home/abc/solana/bin/solana /usr/local/bin

then

solana --version

Get it done

原网站

版权声明
本文为[Lich Howger]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206210626160403.html