blob: 147d2e9d2f44aa1c377bd06a1757616d7a3840bf [file] [log] [blame] [view]
Brian Andersona08c5aa2012-07-10 05:18:371# The Rust Programming Language
Austin Seipp62c4d2c2012-01-23 21:53:122
Brian Andersonc92d2ed2012-07-10 05:13:483This is a compiler for Rust, including standard libraries, tools and
4documentation.
5
Jack Moffitt8d64fa32013-07-18 23:27:436## Quick Start
Brian Andersonc92d2ed2012-07-10 05:13:487
Falco Hirschenbergerba9c51d2014-04-04 16:22:5581. Download a [binary installer][installer] for your platform.
Steve Klabnik16a6ebd2014-12-02 14:20:4892. Read [The Rust Programming Language][trpl].
Alex Crichton46867cc2014-04-02 23:59:39103. Enjoy!
Austin Seipp62c4d2c2012-01-23 21:53:1211
Adrien Tétara30d61b2014-01-11 14:19:3812> ***Note:*** Windows users can read the detailed
Ruud van Asseldonk3431c0a2014-10-08 22:32:2213> [using Rust on Windows][win-wiki] notes on the wiki.
Jack Moffitt8d64fa32013-07-18 23:27:4314
Alex Crichton46867cc2014-04-02 23:59:3915[installer]: http://www.rust-lang.org/install.html
Steve Klabnik16a6ebd2014-12-02 14:20:4816[trpl]: http://doc.rust-lang.org/book/index.html
Brian Andersonf4ae8a82014-06-16 23:07:3417[win-wiki]: https://github.com/rust-lang/rust/wiki/Using-Rust-on-Windows
Jack Moffitt8d64fa32013-07-18 23:27:4318
Alex Crichton46867cc2014-04-02 23:59:3919## Building from Source
Jack Moffitt8d64fa32013-07-18 23:27:4320
Adrien Tétara30d61b2014-01-11 14:19:38211. Make sure you have installed the dependencies:
James Laverack72f478f2014-05-05 02:03:0022 * `g++` 4.7 or `clang++` 3.x
Adrien Tétara30d61b2014-01-11 14:19:3823 * `python` 2.6 or later (but not 3.x)
24 * `perl` 5.0 or later
25 * GNU `make` 3.81 or later
26 * `curl`
mdinger065c4a62014-04-18 18:50:3127 * `git`
Adrien Tétara30d61b2014-01-11 14:19:38282. Download and build Rust:
29
Jack Moffitt8d64fa32013-07-18 23:27:4330 You can either download a [tarball] or build directly from the [repo].
Adrien Tétara30d61b2014-01-11 14:19:3831
Jack Moffitt8d64fa32013-07-18 23:27:4332 To build from the [tarball] do:
Adrien Tétara30d61b2014-01-11 14:19:3833
Brian Anderson21a70b32014-08-11 19:30:3734 $ curl -O https://static.rust-lang.org/dist/rust-nightly.tar.gz
Brian Anderson0875ffc2014-04-03 23:28:4635 $ tar -xzf rust-nightly.tar.gz
36 $ cd rust-nightly
Adrien Tétara30d61b2014-01-11 14:19:3837
Jack Moffitt8d64fa32013-07-18 23:27:4338 Or to build from the [repo] do:
39
Brian Andersonf4ae8a82014-06-16 23:07:3440 $ git clone https://github.com/rust-lang/rust.git
Jack Moffitt8d64fa32013-07-18 23:27:4341 $ cd rust
42
43 Now that you have Rust's source code, you can configure and build it:
Adrien Tétara30d61b2014-01-11 14:19:3844
Jack Moffitt8d64fa32013-07-18 23:27:4345 $ ./configure
46 $ make && make install
Adrien Tétara30d61b2014-01-11 14:19:3847
48 > ***Note:*** You may need to use `sudo make install` if you do not normally have
49 > permission to modify the destination directory. The install locations can
50 > be adjusted by passing a `--prefix` argument to `configure`. Various other
51 > options are also supported, pass `--help` for more information on them.
Jack Moffitt8d64fa32013-07-18 23:27:4352
53 When complete, `make install` will place several programs into
Corey Richardson25fe2ca2014-02-02 07:56:5554 `/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
55 API-documentation tool.
Steve Klabnik16a6ebd2014-12-02 14:20:48563. Read [The Rust Programming Language][trpl].
Jack Moffitt8d64fa32013-07-18 23:27:43574. Enjoy!
58
Luqman Aden8b833552014-06-27 00:07:4459### Building on Windows
60
Steve Klabnik0017bfa2015-01-12 20:56:1661To easily build on windows we can use [MSYS2](http://msys2.github.io/):
Luqman Aden8b833552014-06-27 00:07:4462
631. Grab the latest MSYS2 installer and go through the installer.
642. Now from the MSYS2 terminal we want to install the mingw64 toolchain and the other
65 tools we need.
66
Steve Klabnik59923252015-01-12 21:00:0367```bash
68# choose one based on platform
69$ pacman -S mingw-w64-i686-toolchain
70$ pacman -S mingw-w64-x86_64-toolchain
Luqman Aden8b833552014-06-27 00:07:4471
Steve Klabnik59923252015-01-12 21:00:0372$ pacman -S base-devel
73```
74
753. With that now start `mingw32_shell.bat` or `mingw64_shell.bat`
76 from where you installed MSYS2 (i.e. `C:\msys`). Which one you
77 choose depends on if you want 32 or 64 bit Rust.
Luqman Aden8b833552014-06-27 00:07:44784. From there just navigate to where you have Rust's source code, configure and build it:
79
klutzya3d77e62014-08-22 16:45:1580 $ ./configure
Luqman Aden8b833552014-06-27 00:07:4481 $ make && make install
82
Brian Andersonf4ae8a82014-06-16 23:07:3483[repo]: https://github.com/rust-lang/rust
Brian Anderson21a70b32014-08-11 19:30:3784[tarball]: https://static.rust-lang.org/dist/rust-nightly.tar.gz
Steve Klabnik16a6ebd2014-12-02 14:20:4885[trpl]: http://doc.rust-lang.org/book/index.html
Jack Moffitt8d64fa32013-07-18 23:27:4386
87## Notes
88
89Since the Rust compiler is written in Rust, it must be built by a
90precompiled "snapshot" version of itself (made in an earlier state of
91development). As such, source builds require a connection to the Internet, to
92fetch snapshots, and an OS that can execute the available snapshot binaries.
Austin Seipp62c4d2c2012-01-23 21:53:1293
Brian Anderson4c833af2012-10-11 00:56:3894Snapshot binaries are currently built and tested on several platforms:
Brian Anderson3403e412012-07-10 05:20:3295
Taylor Hutchison4474eab2014-10-10 04:41:3096* Windows (7, 8, Server 2008 R2), x86 and x86-64 (64-bit support added in Rust 0.12.0)
Daniel Micayb5334b32014-01-31 14:58:0097* Linux (2.6.18 or later, various distributions), x86 and x86-64
Daniel Micayd2445122014-01-31 14:50:4498* OSX 10.7 (Lion) or greater, x86 and x86-64
Austin Seipp62c4d2c2012-01-23 21:53:1299
Adrien Tétara30d61b2014-01-11 14:19:38100You may find that other platforms work, but these are our officially
Brian Anderson4c833af2012-10-11 00:56:38101supported build environments that are most likely to work.
Austin Seipp62c4d2c2012-01-23 21:53:12102
Adrien Tétara30d61b2014-01-11 14:19:38103Rust currently needs about 1.5 GiB of RAM to build without swapping; if it hits
Jack Moffitt8d64fa32013-07-18 23:27:43104swap, it will take a very long time to build.
Brian Anderson4c833af2012-10-11 00:56:38105
Adrien Tétara30d61b2014-01-11 14:19:38106There is a lot more documentation in the [wiki].
Austin Seipp62c4d2c2012-01-23 21:53:12107
Brian Andersonf4ae8a82014-06-16 23:07:34108[wiki]: https://github.com/rust-lang/rust/wiki
Austin Seipp62c4d2c2012-01-23 21:53:12109
Brian Andersoncd1fabe2014-08-22 18:04:35110## Getting help and getting involved
111
112The Rust community congregates in a few places:
113
114* [StackOverflow] - Get help here.
115* [/r/rust] - General discussion.
116* [discuss.rust-lang.org] - For development of the Rust language itself.
117
118[StackOverflow]: http://stackoverflow.com/questions/tagged/rust
119[/r/rust]: http://reddit.com/r/rust
120[discuss.rust-lang.org]: http://discuss.rust-lang.org/
121
Brian Andersonc92d2ed2012-07-10 05:13:48122## License
Austin Seipp62c4d2c2012-01-23 21:53:12123
Brian Anderson11a99182012-12-28 21:40:33124Rust is primarily distributed under the terms of both the MIT license
125and the Apache License (Version 2.0), with portions covered by various
126BSD-like licenses.
Austin Seipp62c4d2c2012-01-23 21:53:12127
Brian Anderson11a99182012-12-28 21:40:33128See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.