1 # The Rust Programming Language
3 This is a compiler for Rust, including standard libraries, tools and
8 Read ["Installing Rust"][install] from [The Book][trpl].
10 [install]: http://doc.rust-lang.org/book/installing-rust.html
11 [trpl]: http://doc.rust-lang.org/book/index.html
13 ## Building from Source
15 1. Make sure you have installed the dependencies:
16 * `g++` 4.7 or `clang++` 3.x
17 * `python` 2.6 or later (but not 3.x)
18 * GNU `make` 3.81 or later
22 2. Download and build Rust:
24 You can either download a [tarball] or build directly from the [repo].
26 To build from the [tarball] do:
28 $ curl -O https://static.rust-lang.org/dist/rustc-nightly-src.tar.gz
29 $ tar -xzf rustc-nightly-src.tar.gz
32 Or to build from the [repo] do:
34 $ git clone https://github.com/rust-lang/rust.git
37 Now that you have Rust's source code, you can configure and build it:
40 $ make && make install
42 > ***Note:*** You may need to use `sudo make install` if you do not normally have
43 > permission to modify the destination directory. The install locations can
44 > be adjusted by passing a `--prefix` argument to `configure`. Various other
45 > options are also supported, pass `--help` for more information on them.
47 When complete, `make install` will place several programs into
48 `/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
49 API-documentation tool.
51 ### Building on Windows
53 To easily build on windows we can use [MSYS2](http://msys2.github.io/):
55 1. Grab the latest MSYS2 installer and go through the installer.
56 2. Now from the MSYS2 terminal we want to install the mingw64 toolchain and the other
60 # choose one based on platform
61 $ pacman -S mingw-w64-i686-toolchain
62 $ pacman -S mingw-w64-x86_64-toolchain
64 $ pacman -S base-devel
67 3. With that now start `mingw32_shell.bat` or `mingw64_shell.bat`
68 from where you installed MSYS2 (i.e. `C:\msys`). Which one you
69 choose depends on if you want 32 or 64 bit Rust.
70 4. From there just navigate to where you have Rust's source code, configure and build it:
73 $ make && make install
75 [repo]: https://github.com/rust-lang/rust
76 [tarball]: https://static.rust-lang.org/dist/rustc-nightly-src.tar.gz
80 Since the Rust compiler is written in Rust, it must be built by a
81 precompiled "snapshot" version of itself (made in an earlier state of
82 development). As such, source builds require a connection to the Internet, to
83 fetch snapshots, and an OS that can execute the available snapshot binaries.
85 Snapshot binaries are currently built and tested on several platforms:
87 * Windows (7, 8, Server 2008 R2), x86 and x86-64 (64-bit support added in Rust 0.12.0)
88 * Linux (2.6.18 or later, various distributions), x86 and x86-64
89 * OSX 10.7 (Lion) or greater, x86 and x86-64
91 You may find that other platforms work, but these are our officially
92 supported build environments that are most likely to work.
94 Rust currently needs about 1.5 GiB of RAM to build without swapping; if it hits
95 swap, it will take a very long time to build.
97 There is a lot more documentation in the [wiki].
99 [wiki]: https://github.com/rust-lang/rust/wiki
103 The Rust community congregates in a few places:
105 * [StackOverflow] - Direct questions about using the language here.
106 * [users.rust-lang.org] - General discussion, broader questions.
107 * [/r/rust] - News and general discussion.
109 [StackOverflow]: http://stackoverflow.com/questions/tagged/rust
110 [/r/rust]: http://reddit.com/r/rust
111 [users.rust-lang.org]: http://users.rust-lang.org/
115 To contribute to Rust, please see [CONTRIBUTING.md](CONTRIBUTING.md).
119 Rust is primarily distributed under the terms of both the MIT license
120 and the Apache License (Version 2.0), with portions covered by various
123 See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.