446 字
2 分钟
使用scoop配置rust环境
rust包和rustup包的区别
rust包是一个固定版本的独立安装包,而rustup是rust的版本管理器,建议装rustup
安装过程中注意事项
代理问题
我使用的Nushell工具运行 scoop 安装的 rustup ,虽然 scoop 配置了代理,但是在安装 rustup 的过程中,rustup 也会下载一些工具包,此时scoop的代理是不能传递到 rustup 中去的,所以需要特殊配置。我们可以使用:
HTTPS_PROXY="http://127.0.0.1:3067" scoop install rustup这条命令前边的一串,相当于是告诉Nushell这条命令的执行,需要遵循这一条环境变量,那么这条命令以及这条命令所引伸出来带的命令全都会使用这个环境变量。
安装后续问题
安装完成后会提示
Notes-----This package defaults to using the MSVC toolchain in new installs; use "rustup set default-host" to configure it(existing installs may be using the GNU toolchain by default)According to https://doc.rust-lang.org/book/ch01-01-installation.html#installing-rustup-on-windowsMicrosoft C++ Build Tools is needed and can be downloaded here:https://visualstudio.microsoft.com/visual-cpp-build-tools/When installing build tools, these two components should be selected:- MSVC - VS C++ x64/x86 build tools- Windows SDKRust 本身并不包含连接代码(链接器)和 Windows 系统的底层库。即便安装了 rustup ,如果没有按照提示安装 Microsoft C++ Build Tools,在尝试编译第一个 Hello World 时就会遇到类似 linker ‘link.exe’ not found 的错误。
可以通过rustup toolchain list观察现在使用的是什么链接器,如果使用的是 MSVC 工具链,则需要安装MSVC - VS C++ x64/x86 build tools和Windows SDK。
使用rustup install stable-xxx来安装对应工具链的rust,使用rustup default stable-xxx来应用。
CAUTION我在配置过程中使用的
gnullvm的工具链,正好可以配合我的mingw-mstorsjo-llvm-ucrt,msvc的编译器太大了,四个多G,C盘吃不消。
使用scoop配置rust环境
https://fuwari.vercel.app/posts/使用scoop配置rust环境/