构建 Cargo 自身需要使用 Cargo 作为依赖项吗?

3

以下是 Cargo README 中所述的内容:

Compiling from Source

Cargo requires the following tools and packages to build:

  • python
  • curl (on Unix)
  • cmake
  • OpenSSL headers (only for Unix, this is the libssl-dev package on ubuntu)
  • cargo and rustc

First, you'll want to check out this repository

git clone --recursive https://github.com/rust-lang/cargo 
cd cargo

With cargo already installed, you can simply run:

cargo build --release

Otherwise, you can also use a more traditional approach:

./configure
make
make install

这说明Cargo是构建Cargo所需的依赖项,但也似乎表明如果未安装Cargo,则以./configure开头的方法应该能正常工作。

当我克隆该存储库并运行./configure时,出现错误。

...
configure: found cmake
configure: found make
configure: recreating config.tmp
configure: 
configure: processing ./configure args
configure: 
configure: CFG_PREFIX           := /usr/local 
configure: CFG_LOCAL_RUST_ROOT  :=  
configure: CFG_CARGO            := cargo 
configure: CFG_RUSTC            := rustc 
configure: CFG_RUSTDOC          := rustdoc 
configure: CFG_CARGO            :=  
configure: error: needed, but unable to find any of: CFG_CARGO cargo

这是否意味着我没有安装Cargo就无法从源代码构建Cargo?也许缺少一个传递给configure的参数?
我从源代码构建了Rust,因为我在这个系统上不是特权用户,并且将其安装在我的用户目录中。

6
如果您不是特权用户,也不需要自己构建Rust或Cargo。 Rustup会将所有内容安装到您的主目录中。 - Shepmaster
哇,我会... - turbulencetoo
1个回答

2
根据问题3772的讨论:

确实,编译Cargo需要使用Cargo。在将来的Rust版本中,我们将会有--enable-extended选项,它将编译Rust和Cargo。

但是可以找到一些cargo引导脚本。例如:https://github.com/dhuseby/cargo-bootstrap

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接