@@ -6,11 +6,7 @@ standard library, and documentation.
6
6
[ Rust ] : https://www.rust-lang.org
7
7
8
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
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
@@ -48,20 +44,37 @@ by running it with the `--help` flag or reading the [rustc dev guide][rustcguide
48
44
[ gettingstarted ] : https://rustc-dev-guide.rust-lang.org/getting-started.html
49
45
[ rustcguidebuild ] : https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html
50
46
51
- ### Building on a Unix-like system
52
- 1 . Make sure you have installed the dependencies:
47
+ ### Dependencies
48
+
49
+ Make sure you have installed the dependencies:
53
50
54
- * ` g++ ` 5.1 or later or ` clang++ ` 3.5 or later
55
51
* ` python ` 3 or 2.7
56
- * GNU ` make ` 3.81 or later
57
- * ` cmake ` 3.13.4 or later
58
- * ` ninja `
59
- * ` curl `
60
52
* ` git `
61
- * ` ssl ` which comes in ` libssl-dev ` or ` openssl-devel `
53
+ * A C compiler (when building for the host, ` cc ` is enough; cross-compiling may need additional compilers)
54
+ * ` curl ` (not needed on Windows)
62
55
* ` pkg-config ` if you are compiling on Linux and targeting Linux
56
+ * ` libiconv ` (already included with glibc on Debian-based distros)
57
+
58
+ To build cargo, you'll also need OpenSSL (` libssl-dev ` or ` openssl-devel ` on most Unix distros).
59
+
60
+ If building LLVM from source, you'll need additional tools:
61
+
62
+ * ` g++ ` , ` clang++ ` , or MSVC with versions listed on
63
+ [ LLVM's documentation] ( https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library )
64
+ * ` ninja ` , or GNU ` make ` 3.81 or later (ninja is recommended, especially on Windows)
65
+ * ` cmake ` 3.13.4 or later
66
+ * ` libstdc++-static ` may be required on some Linux distributions such as Fedora and Ubuntu
63
67
64
- 2 . Clone the [ source] with ` git ` :
68
+ On tier 1 or tier 2 with host tools platforms, you can also choose to download LLVM by setting ` llvm.download-ci-llvm = true ` .
69
+ Otherwise, you'll need LLVM installed and ` llvm-config ` in your path.
70
+ See [ the rustc-dev-guide for more info] [ sysllvm ] .
71
+
72
+ [ sysllvm ] : https://rustc-dev-guide.rust-lang.org/building/new-target.html#using-pre-built-llvm
73
+
74
+
75
+ ### Building on a Unix-like system
76
+
77
+ 1 . Clone the [ source] with ` git ` :
65
78
66
79
``` sh
67
80
git clone https://github.com/rust-lang/rust.git
@@ -70,38 +83,49 @@ by running it with the `--help` flag or reading the [rustc dev guide][rustcguide
70
83
71
84
[ source ] : https://github.com/rust-lang/rust
72
85
73
- 3 . Configure the build settings:
86
+ 2 . Configure the build settings:
74
87
75
88
The Rust build system uses a file named ` config.toml ` in the root of the
76
89
source tree to determine various configuration settings for the build.
77
- Copy the default ` config.toml.example ` to ` config.toml ` to get started.
90
+ Set up the defaults intended for distros to get started. You can see a full list of options
91
+ in ` config.toml.example ` .
78
92
79
93
``` sh
80
- cp config.toml.example config.toml
94
+ printf ' profile = "user" \nchangelog-seen = 2 \n ' > config.toml
81
95
```
82
96
83
97
If you plan to use ` x.py install` to create an installation, it is recommended
84
98
that you set the ` prefix` value in the ` [install]` section to a directory.
85
99
86
- Create an install directory if you are not installing in the default directory.
87
-
88
- 4. Build and install:
100
+ 3. Build and install:
89
101
90
102
` ` ` sh
91
103
./x.py build && ./x.py install
92
104
` ` `
93
105
94
106
When complete, ` ./x.py install` will place several programs into
95
107
` $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.
108
+ API-documentation tool. If you' ve set `profile = "user"` or `build.extended = true`, it will
109
+ also include [Cargo], Rust' s package manager.
100
110
101
111
[Cargo]: https://github.com/rust-lang/cargo
102
112
103
113
# ## Building on Windows
104
114
115
+ On Windows, we suggest using [winget] to install dependencies by running the following in a terminal:
116
+
117
+ ` ` ` powershell
118
+ winget install -e Python.Python.3
119
+ winget install -e Kitware.CMake
120
+ winget install -e Git.Git
121
+ ` ` `
122
+
123
+ Then edit your system' s `PATH` variable and add: `C:\Program Files\CMake\bin`. See
124
+ [this guide on editing the system `PATH`](https://www.java.com/en/download/help/path.html) from the
125
+ Java documentation.
126
+
127
+ [winget]: https://github.com/microsoft/winget-cli
128
+
105
129
There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by
106
130
Visual Studio and the GNU ABI used by the GCC toolchain. Which version of Rust
107
131
you need depends largely on what C/C++ libraries you want to interoperate with.
@@ -190,7 +214,7 @@ Windows build triples are:
190
214
- ` x86_64-pc-windows-msvc `
191
215
192
216
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
217
+ invoking ` x.py ` commands, or by creating a ` config.toml ` file (as described
194
218
in [ Installing From Source] ( #installing-from-source ) ), and modifying the
195
219
` build ` option under the ` [build] ` section.
196
220
@@ -204,9 +228,7 @@ configure script and makefile (the latter of which just invokes `x.py`).
204
228
make && sudo make install
205
229
```
206
230
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.
231
+ ` configure ` generates a ` config.toml ` which can also be used with normal ` x.py ` invocations.
210
232
211
233
## Building Documentation
212
234
@@ -227,41 +249,20 @@ precompiled "snapshot" version of itself (made in an earlier stage of
227
249
development). As such, source builds require an Internet connection to
228
250
fetch snapshots, and an OS that can execute the available snapshot binaries.
229
251
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
252
+ See https://doc.rust-lang.org/nightly/rustc/platform-support.html for a list of supported platforms.
253
+ Only "host tools" platforms have a pre-compiled snapshot binary available; to compile for a platform
254
+ without host tools you must cross-compile.
243
255
244
256
You may find that other platforms work, but these are our officially
245
257
supported build environments that are most likely to work.
246
258
247
259
## Getting Help
248
260
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/
261
+ See https://www.rust-lang.org/community for a list of chat platforms and forums.
258
262
259
263
## Contributing
260
264
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
265
+ See [ CONTRIBUTING.md] ( CONTRIBUTING.md ) .
265
266
266
267
## License
267
268
0 commit comments