@@ -6,19 +6,22 @@ standard library, and documentation.
6
6
[ Rust ] : https://www.rust-lang.org
7
7
8
8
## Quick Start
9
- [ quick-start ] : #quick-start
10
9
11
10
Read [ "Installation"] from [ The Book] .
12
11
13
12
[ "Installation" ] : https://doc.rust-lang.org/book/ch01-01-installation.html
14
13
[ The Book ] : https://doc.rust-lang.org/book/index.html
15
14
16
15
## Installing from Source
17
- [ building-from-source ] : #building-from-source
18
16
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
22
25
23
26
### Building on * nix
24
27
1 . Make sure you have installed the dependencies:
@@ -39,43 +42,36 @@ of the rustc-guide instead of this section._
39
42
40
43
[ source ] : https://github.com/rust-lang/rust
41
44
42
- 3 . Build and install:
43
-
44
- ``` sh
45
- $ ./x.py build && sudo ./x.py install
46
- ```
45
+ 3 . Configure the build settings:
47
46
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.
49
50
50
- ```
51
- error: failed to load source for a dependency on ' cc '
51
+ ``` sh
52
+ $ cp config.toml.example config.toml
52
53
```
53
54
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.
55
58
56
- ```
57
- $ cargo install cargo-vendor
58
- ```
59
+ 4. Build and install:
59
60
61
+ ` ` ` sh
62
+ $ ./x.py build && ./x.py install
60
63
` ` `
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.
69
64
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
72
67
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.
74
71
75
72
[Cargo]: https://github.com/rust-lang/cargo
76
73
77
74
### Building on Windows
78
- [building-on-windows]: #building-on-windows
79
75
80
76
There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by
81
77
Visual 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
85
81
build.
86
82
87
83
#### MinGW
88
- [windows-mingw]: #windows-mingw
89
84
90
85
[MSYS2][msys2] can be used to easily build Rust on Windows:
91
86
@@ -126,7 +121,6 @@ build.
126
121
```
127
122
128
123
#### MSVC
129
- [ windows-msvc ] : #windows-msvc
130
124
131
125
MSVC builds of Rust additionally require an installation of Visual Studio 2017
132
126
(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.
155
149
` ` `
156
150
157
151
# ### Specifying an ABI
158
- [ specifying-an-abi ] : #specifying-an-abi
159
152
160
153
Each specific ABI can also be used from either environment (for example, using
161
154
the GNU ABI in PowerShell) by using an explicit build triple. The available
@@ -169,11 +162,10 @@ Windows build triples are:
169
162
170
163
The build triple can be specified by either specifying ` --build=< triple> ` when
171
164
invoking ` 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.
174
167
175
168
# ## Configure and Make
176
- [ configure-and-make ] : #configure-and-make
177
169
178
170
While it' s not the recommended build system, this project also provides a
179
171
configure 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
188
180
`config.mk` file.
189
181
190
182
## Building Documentation
191
- [ building-documentation ] : #building-documentation
192
183
193
184
If you’d like to build the documentation, it’s almost the same:
194
185
@@ -201,7 +192,6 @@ the ABI used. I.e., if the ABI was `x86_64-pc-windows-msvc`, the directory will
201
192
`build\x86_64-pc-windows-msvc\doc`.
202
193
203
194
## Notes
204
- [ notes ] : #notes
205
195
206
196
Since the Rust compiler is written in Rust, it must be built by a
207
197
precompiled "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].
224
214
[CONTRIBUTING.md]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md
225
215
226
216
## Getting Help
227
- [ getting-help ] : #getting-help
228
217
229
218
The Rust community congregates in a few places:
230
219
@@ -237,7 +226,6 @@ The Rust community congregates in a few places:
237
226
[users.rust-lang.org]: https://users.rust-lang.org/
238
227
239
228
## Contributing
240
- [ contributing ] : #contributing
241
229
242
230
To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md).
243
231
@@ -258,7 +246,6 @@ Also, you may find the [rustdocs for the compiler itself][rustdocs] useful.
258
246
[rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/
259
247
260
248
# # License
261
- [ license ] : #license
262
249
263
250
Rust is primarily distributed under the terms of both the MIT license
264
251
and 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
268
255
[COPYRIGHT](COPYRIGHT) for details.
269
256
270
257
# # Trademark
271
- [ trademark ] : #trademark
272
258
273
259
The Rust programming language is an open source, community project governed
274
260
by a core team. It is also sponsored by the Mozilla Foundation (“Mozilla”),
0 commit comments