windows安装

安装vs2015

在安装rust之前,windows平台上需要先安装 Microsoft C++ build tools,推荐2015版本。不过不安装,后面在编译时,会报错说”link.exe”无法找到。

  1. note: the msvc targets depend on the msvc linker but `link.exe` was not found
  2. note: please ensure that VS 2013 or VS 2015 was installed with the Visual C++ option
  3. error: aborting due to previous error
  4. error: Could not compile `ws2_32-sys`

打开下面的网站:

http://landinghub.visualstudio.com/visual-cpp-build-tools

选择”Download Visual C++ Build Tools 2015”。

下载之后按照提示一路安装即可。

安装rust

操作系统为windows 10 64位。

下载rustup.init.exe,然后安装,按照指示操作,中间要下载rustc等安装文件。

  1. Rust Visual C++ prerequisites
  2. If you will be targeting the GNU ABI or otherwise know what you are doing then
  3. it is fine to continue installation without the build tools, but otherwise,
  4. install the C++ build tools before proceeding.
  5. Continue? (Y/n) y
  6. Welcome to Rust!
  7. This will download and install the official compiler for the Rust programming
  8. language, and its package manager, Cargo.
  9. It will add the cargo, rustc, rustup and other commands to Cargo's bin
  10. directory, located at:
  11. C:\Users\aoxia\.cargo\bin
  12. This path will then be added to your PATH environment variable by modifying the
  13. HKEY_CURRENT_USER/Environment/PATH registry key.
  14. You can uninstall at any time with rustup self uninstall and these changes will
  15. be reverted.
  16. Current installation options:
  17. default host triple: x86_64-pc-windows-msvc
  18. default toolchain: stable
  19. modify PATH variable: yes
  20. 1) Proceed with installation (default)
  21. 2) Customize installation
  22. 3) Cancel installation
  23. info: updating existing rustup installation
  24. Rust is installed now. Great!
  25. To get started you need Cargo's bin directory (%USERPROFILE%\.cargo\bin) in
  26. your PATH environment variable. Future applications will automatically have the
  27. correct environment, but you may need to restart your current shell.
  28. Press the Enter key to continue.

配置

%USERPROFILE%\.cargo\bin 加入到PATH环境变量中。

验证

执行rustc --version

  1. $> rustc --version
  2. rustc 1.22.1 (05e2e1c41 2017-11-22)