简体   繁体   English

Rustup vs货物二进制文件

[英]Rustup vs Cargo binaries

I just installed Rustup on macOS and noticed that there are two rustc and two cargo binaries: 我刚刚在macOS上安装了Rustup,并注意到有两个rustc和两个cargo Binaries:

  • ~/.cargo/bin/rustc (cargo)
  • ~/.rustup/toolchains/stable-x86_64-apple-darwin/bin/rustc (cargo)

Their versions are exactly the same, but diff shows there exists some difference. 它们的版本完全相同,但是diff显示存在一些差异。 So why are there two different rustc ( cargo ) binaries and which one should I use? 那么,为什么会有两种不同的rustccargo )二进制文件,我应该使用哪一种呢?

The reason there are two files named rustc is because rustup is a toolchain multiplexer. 之所以有两个名为rustc文件,是因为rustup是一个工具链多路复用器。 It lets you install many versions of Rust and easily switch between them. 它使您可以安装多个版本的Rust并在它们之间轻松切换。

The binary installed at ~/.cargo/bin/rustc proxies to the current toolchain that you have selected. 安装在~/.cargo/bin/rustc的二进制文件代理到您选择的当前工具链。 Each installed compiler is kept under the toolchains directory. 每个已安装的编译器都保存在toolchains目录下。

Although the compiler in the toolchains directory appears to be a smaller file, that's only because it's dynamically linked instead of statically linked. 尽管toolchains目录中的编译器似乎是一个较小的文件,但这仅是因为它是动态链接的,而不是静态链接的。

More information can be found on rustup's README . 可以在rustup的README上找到更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何完成 rustup/cargo 命令? - How to complete rustup/cargo commands? 覆盖 Rust 安装默认路径 `$HOME/.cargo` 和 `$HOME/.rustup` - Overriding Rust installation default paths `$HOME/.cargo` and `$HOME/.rustup` 我应该如何更新 Rustup 的版本? 不更新 rustc 或 cargo 的版本 - How should I update the version of Rustup? not updating the version of rustc or cargo 二进制文件的默认 cargo output 目录 - Default cargo output directory for binaries 如何使用工具链为 Linux 上的所有用户安装 rustup 和 cargo? - How to install rustup and cargo with a toolchain for all users on Linux? 带有库+多个二进制文件的货物项目,二进制文件由多个文件组成? - Cargo project with library + multiple binaries, with binaries consisting of multiple files? 如何使用 Cargo 构建多个二进制文件? - How can I build multiple binaries with Cargo? 使 rustc、cargo、rustup、rustdoc 命令在 Linux 的 Windows 子系统中无需 sudo 即可工作 - Make rustc, cargo, rustup, rustdoc commands work without sudo inside the Windows Subsystem for Linux 安装 Cargo 为打包目的构建的二进制文件的推荐方法是什么? - What is the recommended way to install the binaries built by Cargo for packaging purposes? 通过货物安装板条箱时出错:指定的包没有二进制文件 - Error installing a crate via cargo: specified package has no binaries
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM