]> git.lizzy.rs Git - rust.git/blob - README.md
rollup merge of #21354: eddyb/vec-ufcs
[rust.git] / README.md
1 # The Rust Programming Language
2
3 This is a compiler for Rust, including standard libraries, tools and
4 documentation.
5
6 ## Quick Start
7
8 1. Download a [binary installer][installer] for your platform.
9 2. Read [The Rust Programming Language][trpl].
10 3. Enjoy!
11
12 > ***Note:*** Windows users can read the detailed
13 > [using Rust on Windows][win-wiki] notes on the wiki.
14
15 [installer]: http://www.rust-lang.org/install.html
16 [trpl]: http://doc.rust-lang.org/book/index.html
17 [win-wiki]: https://github.com/rust-lang/rust/wiki/Using-Rust-on-Windows
18
19 ## Building from Source
20
21 1. Make sure you have installed the dependencies:
22     * `g++` 4.7 or `clang++` 3.x
23     * `python` 2.6 or later (but not 3.x)
24     * GNU `make` 3.81 or later
25     * `curl`
26     * `git`
27 2. Download and build Rust:
28
29     You can either download a [tarball] or build directly from the [repo].
30
31     To build from the [tarball] do:
32
33         $ curl -O https://static.rust-lang.org/dist/rust-nightly.tar.gz
34         $ tar -xzf rust-nightly.tar.gz
35         $ cd rust-nightly
36
37     Or to build from the [repo] do:
38
39         $ git clone https://github.com/rust-lang/rust.git
40         $ cd rust
41
42     Now that you have Rust's source code, you can configure and build it:
43
44         $ ./configure
45         $ make && make install
46
47     > ***Note:*** You may need to use `sudo make install` if you do not normally have
48     > permission to modify the destination directory. The install locations can
49     > be adjusted by passing a `--prefix` argument to `configure`. Various other
50     > options are also supported, pass `--help` for more information on them.
51
52     When complete, `make install` will place several programs into
53     `/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
54     API-documentation tool.
55 3. Read [The Rust Programming Language][trpl].
56 4. Enjoy!
57
58 ### Building on Windows
59
60 To easily build on windows we can use [MSYS2](http://msys2.github.io/):
61
62 1. Grab the latest MSYS2 installer and go through the installer.
63 2. Now from the MSYS2 terminal we want to install the mingw64 toolchain and the other
64    tools we need.
65
66 ```bash
67 # choose one based on platform
68 $ pacman -S mingw-w64-i686-toolchain
69 $ pacman -S mingw-w64-x86_64-toolchain
70
71 $ pacman -S base-devel
72 ```
73
74 3. With that now start `mingw32_shell.bat` or `mingw64_shell.bat`
75    from where you installed MSYS2 (i.e. `C:\msys`). Which one you
76    choose depends on if you want 32 or 64 bit Rust.
77 4. From there just navigate to where you have Rust's source code, configure and build it:
78
79         $ ./configure
80         $ make && make install
81
82 [repo]: https://github.com/rust-lang/rust
83 [tarball]: https://static.rust-lang.org/dist/rust-nightly.tar.gz
84 [trpl]: http://doc.rust-lang.org/book/index.html
85
86 ## Notes
87
88 Since the Rust compiler is written in Rust, it must be built by a
89 precompiled "snapshot" version of itself (made in an earlier state of
90 development). As such, source builds require a connection to the Internet, to
91 fetch snapshots, and an OS that can execute the available snapshot binaries.
92
93 Snapshot binaries are currently built and tested on several platforms:
94
95 * Windows (7, 8, Server 2008 R2), x86 and x86-64 (64-bit support added in Rust 0.12.0)
96 * Linux (2.6.18 or later, various distributions), x86 and x86-64
97 * OSX 10.7 (Lion) or greater, x86 and x86-64
98
99 You may find that other platforms work, but these are our officially
100 supported build environments that are most likely to work.
101
102 Rust currently needs about 1.5 GiB of RAM to build without swapping; if it hits
103 swap, it will take a very long time to build.
104
105 There is a lot more documentation in the [wiki].
106
107 [wiki]: https://github.com/rust-lang/rust/wiki
108
109 ## Getting help and getting involved
110
111 The Rust community congregates in a few places:
112
113 * [StackOverflow] - Get help here.
114 * [/r/rust] - General discussion.
115 * [discuss.rust-lang.org] - For development of the Rust language itself.
116
117 [StackOverflow]: http://stackoverflow.com/questions/tagged/rust
118 [/r/rust]: http://reddit.com/r/rust
119 [discuss.rust-lang.org]: http://discuss.rust-lang.org/
120
121 ## License
122
123 Rust is primarily distributed under the terms of both the MIT license
124 and the Apache License (Version 2.0), with portions covered by various
125 BSD-like licenses.
126
127 See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.