@@ -5,12 +5,8 @@ standard library, and documentation.
55
66[ Rust ] : https://www.rust-lang.org
77
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.
1410
1511## Quick Start
1612
@@ -24,22 +20,23 @@ Read ["Installation"] from [The Book].
2420The Rust build system uses a Python script called ` x.py ` to build the compiler,
2521which manages the bootstrapping process. It lives at the root of the project.
2622
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:
2824
2925``` sh
3026./x.py < subcommand> [flags]
3127```
3228
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:
3630
3731``` 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]
4034
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]
4340```
4441
4542More 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
4845[ gettingstarted ] : https://rustc-dev-guide.rust-lang.org/getting-started.html
4946[ rustcguidebuild ] : https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html
5047
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:
5351
54- * ` g++ ` 5.1 or later or ` clang++ ` 3.5 or later
5552 * ` python ` 3 or 2.7
56- * GNU ` make ` 3.81 or later
57- * ` cmake ` 3.13.4 or later
58- * ` ninja `
59- * ` curl `
6053 * ` 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)
6256 * ` 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
6377
64- 2 . Clone the [ source] with ` git ` :
78+ 1 . Clone the [ source] with ` git ` :
6579
6680 ``` sh
6781 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
7084
7185[ source ] : https://github.com/rust-lang/rust
7286
73- 3 . Configure the build settings:
87+ 2 . Configure the build settings:
7488
7589 The Rust build system uses a file named ` config.toml ` in the root of the
7690 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 ` .
7893
7994 ``` sh
80- cp config.toml.example config.toml
95+ printf ' profile = "user" \nchangelog-seen = 2 \n ' > config.toml
8196 ```
8297
8398 If you plan to use ` x.py install` to create an installation, it is recommended
8499 that you set the ` prefix` value in the ` [install]` section to a directory.
85100
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:
89102
90103 ` ` ` sh
91104 ./x.py build && ./x.py install
92105 ` ` `
93106
94107 When complete, ` ./x.py install` will place several programs into
95108 ` $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.
100111
101112[Cargo]: https://github.com/rust-lang/cargo
102113
103114# ## Building on Windows
104115
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+
105130There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by
106131Visual Studio and the GNU ABI used by the GCC toolchain. Which version of Rust
107132you need depends largely on what C/C++ libraries you want to interoperate with.
@@ -190,7 +215,7 @@ Windows build triples are:
190215 - ` x86_64-pc-windows-msvc `
191216
192217The 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
194219in [ Installing From Source] ( #installing-from-source ) ), and modifying the
195220` build ` option under the ` [build] ` section.
196221
@@ -204,9 +229,7 @@ configure script and makefile (the latter of which just invokes `x.py`).
204229make && sudo make install
205230```
206231
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.
210233
211234## Building Documentation
212235
@@ -227,41 +250,20 @@ precompiled "snapshot" version of itself (made in an earlier stage of
227250development). As such, source builds require an Internet connection to
228251fetch snapshots, and an OS that can execute the available snapshot binaries.
229252
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.
243256
244257You may find that other platforms work, but these are our officially
245258supported build environments that are most likely to work.
246259
247260## Getting Help
248261
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.
258263
259264## Contributing
260265
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 ) .
265267
266268## License
267269
0 commit comments