https://www.rust-lang.org/learn/get-started
https://doc.rust-lang.org/stable/book/ch01-01-installation.html#installing-rustup-on-windows
https://www.rust-lang.org/tools/install

rust底层是依赖C环境,所以需要先安装C/C++编译环境, 有两种选择:安装微软的msvc或者安装mingw/cygwin。
https://sourceforge.net/projects/mingw-w64/files/
选择 x86_64-posix-seh 下载 x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z 解压到指定目录,比如 D:\soft_setup
增加设置 PATH 环境变量 D:\soft_setup\mingw64\bin
设置好安装环境变量
CARGO_HOME
RUSTUP_HOME
启动 rustup-init.exe 进行安装 选定制

  1. 输入2选择Customize Installition。
  2. 输入Default host triple:x86_64-pc-windows-gnu
  3. 后续直接按==Enter==键,使用默认参数。

vscode 安装两个rls 相关的插件
可以在 终端 看到 命令信息 rustc —version ,如果看不到 重启一下 vscode

https://www.msys2.org/ 安装 msys2 tool

msys2 使用

https://repo.msys2.org/distrib/x86_64/msys2-x86_64-20201109.exe 文件下载失败。
请访问该镜像目录下的 distrib/ 目录(x86_64i686),找到名为 msys2-<架构>-<日期>.exe 的文件(如 msys2-x86_64-20141113.exe),下载安装即可。
https://mirror.tuna.tsinghua.edu.cn/help/msys2/
https://mirrors.tuna.tsinghua.edu.cn/msys2/distrib/x86_64/ 也可以从这两个地方下载
使用 https://github.com/msys2/msys2-installer 下载安装 ,
pacman -S vim 安装vim

更新源

编辑 /etc/pacman.d/mirrorlist.mingw32 ,在文件开头添加:

  1. Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686

编辑 /etc/pacman.d/mirrorlist.mingw64 ,在文件开头添加:

Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64

编辑 /etc/pacman.d/mirrorlist.msys ,在文件开头添加:

Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch

然后执行 pacman -Sy 刷新软件包数据即可。
pacman -Syu
pacman -S mingw-w64-x86_64-toolchain 安装工具链
pacman -S openssl-devel pkg-config
在msys2 下安装 rust 使用提前设置 好的环境变量
curl —proto ‘=https’ —tlsv1.2 -sSf https://sh.rustup.rs | sh
使用 Default host triple:x86_64-pc-windows-gnu
在.bashrc 中增加
export PATH=/usr/local/lib:$PATH:/d/soft_setup/cargo/bin:.

rustc —version 查看是否正确
其他工具安装
pacman -S base-devel git wget p7zip perl ruby python2
pacman -S cmake

其他安装
make mingw-w64-x86_64-cmake mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi

http://repo.msys2.org/mingw/x86_64/ 提供1.72 -1.75 版本。mingw-w64-x86_64-boost-1.72.0-2-any.pkg.tar.zst
wget http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-boost-1.75.0-2-any.pkg.tar.zst

wget http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-icu-68.2-2-any.pkg.tar.zst

pacman -U mingw-w64-x86_64-icu-68.2-2-any.pkg.tar.zst
pacman -U mingw-w64-x86_64-boost-1.75.0-2-any.pkg.tar.zst
卸载
pacman -R mingw-w64-x86_64-boost

在win10环境变量 PATH 中 增加 D:\soft_setup\msys64\mingw64\bin

在D:\soft_setup\cargo目录下增加文件名 config 的文件 指定mingw64内容
[target.x86_64-pc-windows-gnu]
linker = “D:\soft_setup\msys64\mingw64\bin\gcc.exe”
ar = “D:\soft_setup\msys64\mingw64\bin\ar.exe”
保存退出

在 /home/mycoin 下git clone 代码进行编译即可
WeDPR-Lab-Core

rustup self uninstall 卸载

rust 网络编程
https://zhuanlan.zhihu.com/p/136267743

Note: If rustup is already installed, then rerunning rustup-init won’t actually install the requested toolchain. Instead, run rustup toolchain install stable-x86_64-pc-windows-gnu if you already have the MSVC-based toolchain. Then run rustup default stable-x86_64-pc-windows-gnu to set the GNU-based toolchain as the default.
Rustup will install the MinGW linker and platform libraries automatically (as part of the rust-mingw component) and refuses to let you remove them. If you prefer to use the MinGW linker and libraries you installed with MSYS2, you’ll need to create a .cargo/config file (either in your profile directory, i.e. C:\Users\you.cargo\config, or in your project’s directory if this configuration is specific to a project). The contents of that file might look like this:
[target.x86_64-pc-windows-gnu]
linker = “C:\msys2\mingw64\bin\gcc.exe”
ar = “C:\msys2\mingw64\bin\ar.exe”

Rustup will modify the PATH environment variable unless you told it not to. However, MSYS2 resets PATH by default when you launch, so when you try to invoke cargo or rustc from your MSYS2 shell, it might not find it. You’ll need to edit your .profile/.bash_profile script to set the PATH correctly (you need to prepend /c/Users/yourname/.cargo/bin: to PATH).