Cargo 是否依赖于从源代码构建 Cargo 本身?
Is Cargo a dependency to build Cargo itself from source?
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
开头的方法应该有效。
当我克隆那个 repo 并且 运行 ./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,因为我不是该系统的特权用户,并且在我的用户目录中安装了 Rust。
根据这里的讨论Issue 3772:
Indeed yeah Cargo is required to compile Cargo. In future Rust releases we'll have --enable-extended which will compile Cargo as well as Rust.
但是可以找到一些 cargo 引导脚本。例如:https://github.com/dhuseby/cargo-bootstrap.
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
andrustc
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
开头的方法应该有效。
当我克隆那个 repo 并且 运行 ./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,因为我不是该系统的特权用户,并且在我的用户目录中安装了 Rust。
根据这里的讨论Issue 3772:
Indeed yeah Cargo is required to compile Cargo. In future Rust releases we'll have --enable-extended which will compile Cargo as well as Rust.
但是可以找到一些 cargo 引导脚本。例如:https://github.com/dhuseby/cargo-bootstrap.