Brian Anderson | a08c5aa | 2012-07-10 05:18:37 | [diff] [blame] | 1 | # The Rust Programming Language |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 2 | |
Brian Anderson | c92d2ed | 2012-07-10 05:13:48 | [diff] [blame] | 3 | This is a compiler for Rust, including standard libraries, tools and |
| 4 | documentation. |
| 5 | |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 6 | ## Quick Start |
Brian Anderson | c92d2ed | 2012-07-10 05:13:48 | [diff] [blame] | 7 | |
Falco Hirschenberger | ba9c51d | 2014-04-04 16:22:55 | [diff] [blame] | 8 | 1. Download a [binary installer][installer] for your platform. |
Steve Klabnik | 16a6ebd | 2014-12-02 14:20:48 | [diff] [blame] | 9 | 2. Read [The Rust Programming Language][trpl]. |
Alex Crichton | 46867cc | 2014-04-02 23:59:39 | [diff] [blame] | 10 | 3. Enjoy! |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 11 | |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 12 | > ***Note:*** Windows users can read the detailed |
Ruud van Asseldonk | 3431c0a | 2014-10-08 22:32:22 | [diff] [blame] | 13 | > [using Rust on Windows][win-wiki] notes on the wiki. |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 14 | |
Alex Crichton | 46867cc | 2014-04-02 23:59:39 | [diff] [blame] | 15 | [installer]: http://www.rust-lang.org/install.html |
Steve Klabnik | 16a6ebd | 2014-12-02 14:20:48 | [diff] [blame] | 16 | [trpl]: http://doc.rust-lang.org/book/index.html |
Brian Anderson | f4ae8a8 | 2014-06-16 23:07:34 | [diff] [blame] | 17 | [win-wiki]: https://github.com/rust-lang/rust/wiki/Using-Rust-on-Windows |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 18 | |
Alex Crichton | 46867cc | 2014-04-02 23:59:39 | [diff] [blame] | 19 | ## Building from Source |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 20 | |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 21 | 1. Make sure you have installed the dependencies: |
James Laverack | 72f478f | 2014-05-05 02:03:00 | [diff] [blame] | 22 | * `g++` 4.7 or `clang++` 3.x |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 23 | * `python` 2.6 or later (but not 3.x) |
| 24 | * `perl` 5.0 or later |
| 25 | * GNU `make` 3.81 or later |
| 26 | * `curl` |
mdinger | 065c4a6 | 2014-04-18 18:50:31 | [diff] [blame] | 27 | * `git` |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 28 | 2. Download and build Rust: |
| 29 | |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 30 | You can either download a [tarball] or build directly from the [repo]. |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 31 | |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 32 | To build from the [tarball] do: |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 33 | |
Brian Anderson | 21a70b3 | 2014-08-11 19:30:37 | [diff] [blame] | 34 | $ curl -O https://static.rust-lang.org/dist/rust-nightly.tar.gz |
Brian Anderson | 0875ffc | 2014-04-03 23:28:46 | [diff] [blame] | 35 | $ tar -xzf rust-nightly.tar.gz |
| 36 | $ cd rust-nightly |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 37 | |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 38 | Or to build from the [repo] do: |
| 39 | |
Brian Anderson | f4ae8a8 | 2014-06-16 23:07:34 | [diff] [blame] | 40 | $ git clone https://github.com/rust-lang/rust.git |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 41 | $ cd rust |
| 42 | |
| 43 | Now that you have Rust's source code, you can configure and build it: |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 44 | |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 45 | $ ./configure |
| 46 | $ make && make install |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 47 | |
| 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 Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 52 | |
| 53 | When complete, `make install` will place several programs into |
Corey Richardson | 25fe2ca | 2014-02-02 07:56:55 | [diff] [blame] | 54 | `/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the |
| 55 | API-documentation tool. |
Steve Klabnik | 16a6ebd | 2014-12-02 14:20:48 | [diff] [blame] | 56 | 3. Read [The Rust Programming Language][trpl]. |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 57 | 4. Enjoy! |
| 58 | |
Luqman Aden | 8b83355 | 2014-06-27 00:07:44 | [diff] [blame] | 59 | ### Building on Windows |
| 60 | |
Steve Klabnik | 0017bfa | 2015-01-12 20:56:16 | [diff] [blame] | 61 | To easily build on windows we can use [MSYS2](http://msys2.github.io/): |
Luqman Aden | 8b83355 | 2014-06-27 00:07:44 | [diff] [blame] | 62 | |
| 63 | 1. Grab the latest MSYS2 installer and go through the installer. |
| 64 | 2. Now from the MSYS2 terminal we want to install the mingw64 toolchain and the other |
| 65 | tools we need. |
| 66 | |
Steve Klabnik | 5992325 | 2015-01-12 21:00:03 | [diff] [blame^] | 67 | ```bash |
| 68 | # choose one based on platform |
| 69 | $ pacman -S mingw-w64-i686-toolchain |
| 70 | $ pacman -S mingw-w64-x86_64-toolchain |
Luqman Aden | 8b83355 | 2014-06-27 00:07:44 | [diff] [blame] | 71 | |
Steve Klabnik | 5992325 | 2015-01-12 21:00:03 | [diff] [blame^] | 72 | $ pacman -S base-devel |
| 73 | ``` |
| 74 | |
| 75 | 3. 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 Aden | 8b83355 | 2014-06-27 00:07:44 | [diff] [blame] | 78 | 4. From there just navigate to where you have Rust's source code, configure and build it: |
| 79 | |
klutzy | a3d77e6 | 2014-08-22 16:45:15 | [diff] [blame] | 80 | $ ./configure |
Luqman Aden | 8b83355 | 2014-06-27 00:07:44 | [diff] [blame] | 81 | $ make && make install |
| 82 | |
Brian Anderson | f4ae8a8 | 2014-06-16 23:07:34 | [diff] [blame] | 83 | [repo]: https://github.com/rust-lang/rust |
Brian Anderson | 21a70b3 | 2014-08-11 19:30:37 | [diff] [blame] | 84 | [tarball]: https://static.rust-lang.org/dist/rust-nightly.tar.gz |
Steve Klabnik | 16a6ebd | 2014-12-02 14:20:48 | [diff] [blame] | 85 | [trpl]: http://doc.rust-lang.org/book/index.html |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 86 | |
| 87 | ## Notes |
| 88 | |
| 89 | Since the Rust compiler is written in Rust, it must be built by a |
| 90 | precompiled "snapshot" version of itself (made in an earlier state of |
| 91 | development). As such, source builds require a connection to the Internet, to |
| 92 | fetch snapshots, and an OS that can execute the available snapshot binaries. |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 93 | |
Brian Anderson | 4c833af | 2012-10-11 00:56:38 | [diff] [blame] | 94 | Snapshot binaries are currently built and tested on several platforms: |
Brian Anderson | 3403e41 | 2012-07-10 05:20:32 | [diff] [blame] | 95 | |
Taylor Hutchison | 4474eab | 2014-10-10 04:41:30 | [diff] [blame] | 96 | * Windows (7, 8, Server 2008 R2), x86 and x86-64 (64-bit support added in Rust 0.12.0) |
Daniel Micay | b5334b3 | 2014-01-31 14:58:00 | [diff] [blame] | 97 | * Linux (2.6.18 or later, various distributions), x86 and x86-64 |
Daniel Micay | d244512 | 2014-01-31 14:50:44 | [diff] [blame] | 98 | * OSX 10.7 (Lion) or greater, x86 and x86-64 |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 99 | |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 100 | You may find that other platforms work, but these are our officially |
Brian Anderson | 4c833af | 2012-10-11 00:56:38 | [diff] [blame] | 101 | supported build environments that are most likely to work. |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 102 | |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 103 | Rust currently needs about 1.5 GiB of RAM to build without swapping; if it hits |
Jack Moffitt | 8d64fa3 | 2013-07-18 23:27:43 | [diff] [blame] | 104 | swap, it will take a very long time to build. |
Brian Anderson | 4c833af | 2012-10-11 00:56:38 | [diff] [blame] | 105 | |
Adrien Tétar | a30d61b | 2014-01-11 14:19:38 | [diff] [blame] | 106 | There is a lot more documentation in the [wiki]. |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 107 | |
Brian Anderson | f4ae8a8 | 2014-06-16 23:07:34 | [diff] [blame] | 108 | [wiki]: https://github.com/rust-lang/rust/wiki |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 109 | |
Brian Anderson | cd1fabe | 2014-08-22 18:04:35 | [diff] [blame] | 110 | ## Getting help and getting involved |
| 111 | |
| 112 | The 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 Anderson | c92d2ed | 2012-07-10 05:13:48 | [diff] [blame] | 122 | ## License |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 123 | |
Brian Anderson | 11a9918 | 2012-12-28 21:40:33 | [diff] [blame] | 124 | Rust is primarily distributed under the terms of both the MIT license |
| 125 | and the Apache License (Version 2.0), with portions covered by various |
| 126 | BSD-like licenses. |
Austin Seipp | 62c4d2c | 2012-01-23 21:53:12 | [diff] [blame] | 127 | |
Brian Anderson | 11a9918 | 2012-12-28 21:40:33 | [diff] [blame] | 128 | See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details. |