@@ -5,12 +5,8 @@ standard library, and documentation.
5
5
6
6
[ Rust ] : https://www.rust-lang.org
7
7
8
- ** Note: this README is for _ users_ rather than _ contributors_ .
9
- If you wish to _ contribute_ to the compiler, you should read the
10
- [ Getting Started] [ gettingstarted ] section of the rustc-dev-guide instead.
11
- You can ask for help in the [ #new members Zulip stream] [ new-members ] .**
12
-
13
- [ new-members ] : https://rust-lang.zulipchat.com/#narrow/stream/122652-new-members
8
+ ** Note: this README is for _ users_ rather than _ contributors_ .**
9
+ If you wish to _ contribute_ to the compiler, you should read [ CONTRIBUTING.md] ( CONTRIBUTING.md ) instead.
14
10
15
11
## Quick Start
16
12
@@ -24,22 +20,23 @@ Read ["Installation"] from [The Book].
24
20
The Rust build system uses a Python script called ` x.py ` to build the compiler,
25
21
which manages the bootstrapping process. It lives at the root of the project.
26
22
27
- The ` x.py ` command can be run directly on most systems in the following format:
23
+ The ` x.py ` command can be run directly on most Unix systems in the following format:
28
24
29
25
``` sh
30
26
./x.py < subcommand> [flags]
31
27
```
32
28
33
- This is how the documentation and examples assume you are running ` x.py ` .
34
-
35
- Systems such as Ubuntu 20.04 LTS do not create the necessary ` python ` command by default when Python is installed that allows ` x.py ` to be run directly. In that case, you can either create a symlink for ` python ` (Ubuntu provides the ` python-is-python3 ` package for this), or run ` x.py ` using Python itself:
29
+ This is how the documentation and examples assume you are running ` x.py ` . Some alternative ways are:
36
30
37
31
``` sh
38
- # Python 3
39
- python3 x.py < subcommand> [flags]
32
+ # On a Unix shell if you don't have the necessary `python3` command
33
+ ./x < subcommand> [flags]
40
34
41
- # Python 2.7
42
- python2.7 x.py < subcommand> [flags]
35
+ # On the Windows Command Prompt (if .py files are configured to run Python)
36
+ x.py < subcommand> [flags]
37
+
38
+ # You can also run Python yourself, e.g.:
39
+ python x.py < subcommand> [flags]
43
40
```
44
41
45
42
More information about ` x.py ` can be found
@@ -48,20 +45,37 @@ by running it with the `--help` flag or reading the [rustc dev guide][rustcguide
48
45
[ gettingstarted ] : https://rustc-dev-guide.rust-lang.org/getting-started.html
49
46
[ rustcguidebuild ] : https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html
50
47
51
- ### Building on a Unix-like system
52
- 1 . Make sure you have installed the dependencies:
48
+ ### Dependencies
49
+
50
+ Make sure you have installed the dependencies:
53
51
54
- * ` g++ ` 5.1 or later or ` clang++ ` 3.5 or later
55
52
* ` python ` 3 or 2.7
56
- * GNU ` make ` 3.81 or later
57
- * ` cmake ` 3.13.4 or later
58
- * ` ninja `
59
- * ` curl `
60
53
* ` git `
61
- * ` ssl ` which comes in ` libssl-dev ` or ` openssl-devel `
54
+ * A C compiler (when building for the host, ` cc ` is enough; cross-compiling may need additional compilers)
55
+ * ` curl ` (not needed on Windows)
62
56
* ` pkg-config ` if you are compiling on Linux and targeting Linux
57
+ * ` libiconv ` (already included with glibc on Debian-based distros)
58
+
59
+ To build cargo, you'll also need OpenSSL (` libssl-dev ` or ` openssl-devel ` on most Unix distros).
60
+
61
+ If building LLVM from source, you'll need additional tools:
62
+
63
+ * ` g++ ` , ` clang++ ` , or MSVC with versions listed on
64
+ [ LLVM's documentation] ( https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library )
65
+ * ` ninja ` , or GNU ` make ` 3.81 or later (ninja is recommended, especially on Windows)
66
+ * ` cmake ` 3.13.4 or later
67
+ * ` libstdc++-static ` may be required on some Linux distributions such as Fedora and Ubuntu
68
+
69
+ On tier 1 or tier 2 with host tools platforms, you can also choose to download LLVM by setting ` llvm.download-ci-llvm = true ` .
70
+ Otherwise, you'll need LLVM installed and ` llvm-config ` in your path.
71
+ See [ the rustc-dev-guide for more info] [ sysllvm ] .
72
+
73
+ [ sysllvm ] : https://rustc-dev-guide.rust-lang.org/building/new-target.html#using-pre-built-llvm
74
+
75
+
76
+ ### Building on a Unix-like system
63
77
64
- 2 . Clone the [ source] with ` git ` :
78
+ 1 . Clone the [ source] with ` git ` :
65
79
66
80
``` sh
67
81
git clone https://github.com/rust-lang/rust.git
@@ -70,38 +84,49 @@ by running it with the `--help` flag or reading the [rustc dev guide][rustcguide
70
84
71
85
[ source ] : https://github.com/rust-lang/rust
72
86
73
- 3 . Configure the build settings:
87
+ 2 . Configure the build settings:
74
88
75
89
The Rust build system uses a file named ` config.toml ` in the root of the
76
90
source tree to determine various configuration settings for the build.
77
- Copy the default ` config.toml.example ` to ` config.toml ` to get started.
91
+ Set up the defaults intended for distros to get started. You can see a full list of options
92
+ in ` config.toml.example ` .
78
93
79
94
``` sh
80
- cp config.toml.example config.toml
95
+ printf ' profile = "user" \nchangelog-seen = 2 \n ' > config.toml
81
96
```
82
97
83
98
If you plan to use ` x.py install` to create an installation, it is recommended
84
99
that you set the ` prefix` value in the ` [install]` section to a directory.
85
100
86
- Create an install directory if you are not installing in the default directory.
87
-
88
- 4. Build and install:
101
+ 3. Build and install:
89
102
90
103
` ` ` sh
91
104
./x.py build && ./x.py install
92
105
` ` `
93
106
94
107
When complete, ` ./x.py install` will place several programs into
95
108
` $PREFIX /bin` : ` rustc` , the Rust compiler, and ` rustdoc` , the
96
- API-documentation tool. This install does not include [Cargo],
97
- Rust' s package manager. To build and install Cargo, you may
98
- run `./x.py install cargo` or set the `build.extended` key in
99
- `config.toml` to `true` to build and install all tools.
109
+ API-documentation tool. If you' ve set `profile = "user"` or `build.extended = true`, it will
110
+ also include [Cargo], Rust' s package manager.
100
111
101
112
[Cargo]: https://github.com/rust-lang/cargo
102
113
103
114
# ## Building on Windows
104
115
116
+ On Windows, we suggest using [winget] to install dependencies by running the following in a terminal:
117
+
118
+ ` ` ` powershell
119
+ winget install -e Python.Python.3
120
+ winget install -e Kitware.CMake
121
+ winget install -e Git.Git
122
+ ` ` `
123
+
124
+ Then edit your system' s `PATH` variable and add: `C:\Program Files\CMake\bin`. See
125
+ [this guide on editing the system `PATH`](https://www.java.com/en/download/help/path.html) from the
126
+ Java documentation.
127
+
128
+ [winget]: https://github.com/microsoft/winget-cli
129
+
105
130
There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by
106
131
Visual Studio and the GNU ABI used by the GCC toolchain. Which version of Rust
107
132
you need depends largely on what C/C++ libraries you want to interoperate with.
@@ -190,7 +215,7 @@ Windows build triples are:
190
215
- ` x86_64-pc-windows-msvc `
191
216
192
217
The build triple can be specified by either specifying ` --build=<triple> ` when
193
- invoking ` x.py` commands, or by copying the ` config.toml` file (as described
218
+ invoking ` x.py ` commands, or by creating a ` config.toml ` file (as described
194
219
in [ Installing From Source] ( #installing-from-source ) ), and modifying the
195
220
` build ` option under the ` [build] ` section.
196
221
@@ -204,9 +229,7 @@ configure script and makefile (the latter of which just invokes `x.py`).
204
229
make && sudo make install
205
230
```
206
231
207
- When using the configure script, the generated `config.mk` file may override the
208
- `config.toml` file. To go back to the `config.toml` file, delete the generated
209
- `config.mk` file.
232
+ ` configure ` generates a ` config.toml ` which can also be used with normal ` x.py ` invocations.
210
233
211
234
## Building Documentation
212
235
@@ -227,41 +250,20 @@ precompiled "snapshot" version of itself (made in an earlier stage of
227
250
development). As such, source builds require an Internet connection to
228
251
fetch snapshots, and an OS that can execute the available snapshot binaries.
229
252
230
- Snapshot binaries are currently built and tested on several platforms:
231
-
232
- | Platform / Architecture | x86 | x86_64 |
233
- |---------------------------------------------|-----|--------|
234
- | Windows (7, 8, 10, ...) | ✓ | ✓ |
235
- | Linux (kernel 3.2, glibc 2.17 or later) | ✓ | ✓ |
236
- | macOS (10.7 Lion or later) | (\*) | ✓ |
237
-
238
- (\*): Apple dropped support for running 32-bit binaries starting from macOS 10.15 and iOS 11.
239
- Due to this decision from Apple, the targets are no longer useful to our users.
240
- Please read [our blog post][macx32] for more info.
241
-
242
- [macx32]: https://blog.rust-lang.org/2020/01/03/reducing-support-for-32-bit-apple-targets.html
253
+ See https://doc.rust-lang.org/nightly/rustc/platform-support.html for a list of supported platforms.
254
+ Only "host tools" platforms have a pre-compiled snapshot binary available; to compile for a platform
255
+ without host tools you must cross-compile.
243
256
244
257
You may find that other platforms work, but these are our officially
245
258
supported build environments that are most likely to work.
246
259
247
260
## Getting Help
248
261
249
- The Rust community congregates in a few places:
250
-
251
- * [Stack Overflow] - Direct questions about using the language.
252
- * [users.rust-lang.org] - General discussion and broader questions.
253
- * [/r/rust] - News and general discussion.
254
-
255
- [Stack Overflow]: https://stackoverflow.com/questions/tagged/rust
256
- [/r/rust]: https://reddit.com/r/rust
257
- [users.rust-lang.org]: https://users.rust-lang.org/
262
+ See https://www.rust-lang.org/community for a list of chat platforms and forums.
258
263
259
264
## Contributing
260
265
261
- If you are interested in contributing to the Rust project, please take a look
262
- at the [Getting Started][gettingstarted] guide in the [rustc-dev-guide].
263
-
264
- [rustc-dev-guide]: https://rustc-dev-guide.rust-lang.org
266
+ See [ CONTRIBUTING.md] ( CONTRIBUTING.md ) .
265
267
266
268
## License
267
269
0 commit comments