cargo README

The project's README from github.com/rust-lang/cargo. As one markdown file: README.md.

Cargo

Cargo downloads your Rust project’s dependencies and compiles your project.

To start using Cargo, learn more at The Cargo Book.

To start developing Cargo itself, read the Cargo Contributor Guide.

The Cargo binary distributed through with Rust is maintained by the Cargo team for use by the wider ecosystem. For all other uses of this crate (as a binary or library) this is maintained by the Cargo team, primarily for use by Cargo and not intended for external use (except as a transitive dependency). This crate may make major changes to its APIs.

Code Status

CI

Code documentation: https://doc.rust-lang.org/nightly/nightly-rustc/cargo/

Compiling from Source

Requirements

Cargo requires the following tools and packages to build:

Other requirements:

The following are optional based on your platform and needs.

Optional system libraries:

The build will automatically use vendored versions of the following libraries. However, if they are provided by the system and can be found with pkg-config, then the system libraries will be used instead:

It is recommended to use the vendored versions as they are the versions that are tested to work with Cargo.

Compiling

First, you'll want to check out this repository

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

With cargo already installed, you can simply run:

cargo build --release

Adding new subcommands to Cargo

Cargo is designed to be extensible with new subcommands without having to modify Cargo itself. See the Wiki page for more details and a list of known community-developed subcommands.

Releases

Cargo releases coincide with Rust releases. High level release notes are available as part of Rust's release notes. Detailed release notes are available in the changelog.

Reporting issues

Found a bug? We'd love to know about it!

Please report all issues on the GitHub issue tracker.

Contributing

See the Cargo Contributor Guide for a complete introduction to contributing to Cargo.

License

Cargo is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.

Third party software

This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (https://www.openssl.org/).

In binary form, this product includes software that is licensed under the terms of the GNU General Public License, version 2, with a linking exception, which can be obtained from the upstream repository.

See LICENSE-THIRD-PARTY for details.

cargo (rust-lang/cargo)

Searching Database…

15.6K ·GitHub
这是什么?Cargo 是 Rust 编程语言官方的包管理器和构建工具。它会下载项目的依赖,并编译项目。
这是库还是命令行工具?它是一个命令行工具(即 cargo 可执行文件),随 Rust 工具链一同发布,不过其中一部分也以 crate 的形式提供,供内部使用。
我自己编译 Cargo 需要先装什么?你需要先装好现成的 cargo 和 rustc、一个 C 编译器和 git。视平台而定,还可以可选安装 pkg-config 以及 OpenSSL/LibreSSL 的头文件。因为 Cargo 默认自带 libcurl、libgit2、libssh2 和 libz 的副本。
我能不修改 Cargo 本身,就用自己的子命令来扩展它吗?可以。Cargo 的设计支持第三方子命令,无需修改 Cargo 本身,wiki 中列出了社区已知的子命令。
Cargo 在 Windows、macOS 和 Linux 上都能运行吗?可以,Cargo 支持这三个平台。在 Windows 上它使用系统自带的 Schannel 而不是 OpenSSL;在 macOS 上它会检查 Homebrew、MacPorts 或 pkgsrc 的安装目录。
既然可以直接安装 Rust,我为什么还要从源码编译 Cargo?大多数用户根本不需要这样做;这套编译流程主要面向为 Cargo 本身贡献代码,或从事编译器工具链开发的人。
Cargo 是否需要内置 curl 之类的网络库,以及 git 支持?需要。它依赖 libcurl 进行网络传输,依赖 libgit2 和 libssh2 来拉取并验证 git 依赖,默认使用自带的副本以保证兼容性。
Cargo 的发布节奏是怎样的?Cargo 的发布与 Rust 自身的发布计划同步,高层级的变更说明见 Rust 的发布说明,详细内容见 Cargo 的更新日志(changelog)。
Creator
rust-lang
Size
73.4 MB
Stars
15.6K
Updated
CommitOct 16
Age
12y
Commits · 90 Days