@@ -6,19 +6,22 @@ standard library, and documentation.
66[ Rust ] : https://www.rust-lang.org
77
88## Quick Start
9- [ quick-start ] : #quick-start
109
1110Read [ "Installation"] from [ The Book] .
1211
1312[ "Installation" ] : https://doc.rust-lang.org/book/ch01-01-installation.html
1413[ The Book ] : https://doc.rust-lang.org/book/index.html
1514
1615## Installing from Source
17- [ building-from-source ] : #building-from-source
1816
19- _ Note: If you wish to contribute to the compiler, you should read
20- [ this chapter] ( https://rust-lang.github.io/rustc-guide/how-to-build-and-run.html )
21- of the rustc-guide instead of this section._
17+ _ Note: If you wish to contribute to the compiler, you should read [ this
18+ chapter] [ rustcguidebuild ] of the rustc-guide instead of this section._
19+
20+ The Rust build system has a Python script called ` x.py ` to bootstrap building
21+ the compiler. More information about it may be found by running ` ./x.py --help `
22+ or reading the [ rustc guide] [ rustcguidebuild ] .
23+
24+ [ rustcguidebuild ] : https://rust-lang.github.io/rustc-guide/how-to-build-and-run.html
2225
2326### Building on * nix
24271 . Make sure you have installed the dependencies:
@@ -39,43 +42,36 @@ of the rustc-guide instead of this section._
3942
4043[ source ] : https://github.com/rust-lang/rust
4144
42- 3 . Build and install:
43-
44- ``` sh
45- $ ./x.py build && sudo ./x.py install
46- ```
45+ 3 . Configure the build settings:
4746
48- If after running ` sudo ./x.py install` you see an error message like
47+ The Rust build system uses a file named ` config.toml ` in the root of the
48+ source tree to determine various configuration settings for the build.
49+ Copy the default ` config.toml.example ` to ` config.toml ` to get started.
4950
50- ```
51- error: failed to load source for a dependency on ' cc '
51+ ``` sh
52+ $ cp config.toml.example config.toml
5253 ```
5354
54- then run these two commands and then try ` sudo ./x.py install` again:
55+ It is recommended that if you plan to use the Rust build system to create
56+ an installation (using ` ./x.py install` ) that you set the ` prefix` value
57+ in the ` [install]` section to a directory that you have write permissions.
5558
56- ```
57- $ cargo install cargo-vendor
58- ```
59+ 4. Build and install:
5960
61+ ` ` ` sh
62+ $ ./x.py build && ./x.py install
6063 ` ` `
61- $ cargo vendor
62- ```
63-
64- > *** Note:*** Install locations can be adjusted by copying the config file
65- > from ` ./config.toml.example` to ` ./config.toml` , and
66- > adjusting the ` prefix` option under ` [install]` . Various other options, such
67- > as enabling debug information, are also supported, and are documented in
68- > the config file.
6964
70- When complete, ` sudo ./x.py install` will place several programs into
71- ` /usr/local /bin` : ` rustc` , the Rust compiler, and ` rustdoc` , the
65+ When complete, ` ./x.py install` will place several programs into
66+ ` $PREFIX /bin` : ` rustc` , the Rust compiler, and ` rustdoc` , the
7267 API-documentation tool. This install does not include [Cargo],
73- Rust' s package manager, which you may also want to build.
68+ Rust' s package manager. To build and install Cargo, you may
69+ run `./x.py install cargo` or set the `build.extended` key in
70+ `config.toml` to `true` to build and install all tools.
7471
7572[Cargo]: https://github.com/rust-lang/cargo
7673
7774### Building on Windows
78- [building-on-windows]: #building-on-windows
7975
8076There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by
8177Visual Studio, and the GNU ABI used by the GCC toolchain. Which version of Rust
@@ -85,7 +81,6 @@ for interop with GNU software built using the MinGW/MSYS2 toolchain use the GNU
8581build.
8682
8783#### MinGW
88- [windows-mingw]: #windows-mingw
8984
9085[MSYS2][msys2] can be used to easily build Rust on Windows:
9186
@@ -126,7 +121,6 @@ build.
126121 ```
127122
128123#### MSVC
129- [ windows-msvc ] : #windows-msvc
130124
131125MSVC builds of Rust additionally require an installation of Visual Studio 2017
132126(or later) so `rustc` can use its linker. The simplest way is to get the
@@ -155,7 +149,6 @@ by manually calling the appropriate vcvars file before running the bootstrap.
155149` ` `
156150
157151# ### Specifying an ABI
158- [ specifying-an-abi ] : #specifying-an-abi
159152
160153Each specific ABI can also be used from either environment (for example, using
161154the GNU ABI in PowerShell) by using an explicit build triple. The available
@@ -169,11 +162,10 @@ Windows build triples are:
169162
170163The build triple can be specified by either specifying ` --build=< triple> ` when
171164invoking ` x.py` commands, or by copying the ` config.toml` file (as described
172- in Building From Source) , and modifying the ` build ` option under the ` [build] `
173- section.
165+ in [Installing From Source]( # installing-from-source)) , and modifying the
166+ ` build ` option under the ` [build] ` section.
174167
175168# ## Configure and Make
176- [ configure-and-make ] : #configure-and-make
177169
178170While it' s not the recommended build system, this project also provides a
179171configure script and makefile (the latter of which just invokes `x.py`).
@@ -188,7 +180,6 @@ When using the configure script, the generated `config.mk` file may override the
188180`config.mk` file.
189181
190182## Building Documentation
191- [ building-documentation ] : #building-documentation
192183
193184If you’d like to build the documentation, it’s almost the same:
194185
@@ -201,7 +192,6 @@ the ABI used. I.e., if the ABI was `x86_64-pc-windows-msvc`, the directory will
201192`build\x86_64-pc-windows-msvc\doc`.
202193
203194## Notes
204- [ notes ] : #notes
205195
206196Since the Rust compiler is written in Rust, it must be built by a
207197precompiled "snapshot" version of itself (made in an earlier stage of
@@ -224,7 +214,6 @@ There is more advice about hacking on Rust in [CONTRIBUTING.md].
224214[CONTRIBUTING.md]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md
225215
226216## Getting Help
227- [ getting-help ] : #getting-help
228217
229218The Rust community congregates in a few places:
230219
@@ -237,7 +226,6 @@ The Rust community congregates in a few places:
237226[users.rust-lang.org]: https://users.rust-lang.org/
238227
239228## Contributing
240- [ contributing ] : #contributing
241229
242230To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md).
243231
@@ -258,7 +246,6 @@ Also, you may find the [rustdocs for the compiler itself][rustdocs] useful.
258246[rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/
259247
260248# # License
261- [ license ] : #license
262249
263250Rust is primarily distributed under the terms of both the MIT license
264251and the Apache License (Version 2.0), with portions covered by various
@@ -268,7 +255,6 @@ See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT), and
268255[COPYRIGHT](COPYRIGHT) for details.
269256
270257# # Trademark
271- [ trademark ] : #trademark
272258
273259The Rust programming language is an open source, community project governed
274260by a core team. It is also sponsored by the Mozilla Foundation (“Mozilla”),
0 commit comments