blob: f92fc653e0ef32719d45f95e5a842d85e8d3bece [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
Brian Andersonaaabdbf2015-02-16 05:08:324documentation. Rust is a systems programming language that is fast,
5memory safe and multithreaded, but does not employ a garbage collector
6or otherwise impose significant runtime overhead.
Brian Andersonc92d2ed2012-07-10 05:13:487
Jack Moffitt8d64fa32013-07-18 23:27:438## Quick Start
Brian Andersonc92d2ed2012-07-10 05:13:489
Brian Anderson73cc4ed2015-02-16 05:20:2710Read ["Installing Rust"] from [The Book].
Austin Seipp62c4d2c2012-01-23 21:53:1211
Brian Anderson73cc4ed2015-02-16 05:20:2712["Installing Rust"]: http://doc.rust-lang.org/book/installing-rust.html
13[The Book]: http://doc.rust-lang.org/book/index.html
Jack Moffitt8d64fa32013-07-18 23:27:4314
Alex Crichton46867cc2014-04-02 23:59:3915## Building from Source
Jack Moffitt8d64fa32013-07-18 23:27:4316
Adrien Tétara30d61b2014-01-11 14:19:38171. Make sure you have installed the dependencies:
Kevin Yap24fa6be2015-02-21 22:46:0618
19 * `g++` 4.7 or `clang++` 3.x
20 * `python` 2.6 or later (but not 3.x)
21 * GNU `make` 3.81 or later
22 * `curl`
23 * `git`
Steve Klabnikf645cad2015-02-13 17:26:4424
Brian Anderson7430e582015-02-18 21:46:20252. Clone the [source] with `git`:
Jack Moffitt8d64fa32013-07-18 23:27:4326
Kevin Yap24fa6be2015-02-21 22:46:0627 ```sh
28 $ git clone https://github.com/rust-lang/rust.git
29 $ cd rust
30 ```
Jack Moffitt8d64fa32013-07-18 23:27:4331
Brian Anderson4acc4832015-02-16 04:20:2532[source]: https://github.com/rust-lang/rust
33
343. Build and install:
Adrien Tétara30d61b2014-01-11 14:19:3835
Kevin Yap24fa6be2015-02-21 22:46:0636 ```sh
37 $ ./configure
38 $ make && make install
39 ```
Adrien Tétara30d61b2014-01-11 14:19:3840
Kevin Yap24fa6be2015-02-21 22:46:0641 > ***Note:*** You may need to use `sudo make install` if you do not
42 > normally have permission to modify the destination directory. The
43 > install locations can be adjusted by passing a `--prefix` argument
44 > to `configure`. Various other options are also supported pass
45 > `--help` for more information on them.
Jack Moffitt8d64fa32013-07-18 23:27:4346
47 When complete, `make install` will place several programs into
Corey Richardson25fe2ca2014-02-02 07:56:5548 `/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
Brian Anderson21ed20b2015-02-16 04:41:1649 API-documentation tool. This install does not include [Cargo],
50 Rust's package manager, which you may also want to build.
51
52[Cargo]: https://github.com/rust-lang/cargo
Jack Moffitt8d64fa32013-07-18 23:27:4353
Luqman Aden8b833552014-06-27 00:07:4454### Building on Windows
55
Kevin Yap24fa6be2015-02-21 22:46:0656[MSYS2](http://msys2.github.io/) can be used to easily build Rust on Windows:
Luqman Aden8b833552014-06-27 00:07:4457
581. Grab the latest MSYS2 installer and go through the installer.
Luqman Aden8b833552014-06-27 00:07:4459
Kevin Yap24fa6be2015-02-21 22:46:06602. From the MSYS2 terminal, install the `mingw64` toolchain and other required
61 tools.
Luqman Aden8b833552014-06-27 00:07:4462
Kevin Yap24fa6be2015-02-21 22:46:0663 ```sh
64 # Choose one based on platform:
65 $ pacman -S mingw-w64-i686-toolchain
66 $ pacman -S mingw-w64-x86_64-toolchain
Tamir Dubersteinf5765792015-03-14 23:09:2667
Kevin Yap24fa6be2015-02-21 22:46:0668 $ pacman -S base-devel
69 ```
Steve Klabnik59923252015-01-12 21:00:0370
Kevin Yap24fa6be2015-02-21 22:46:06713. Run `mingw32_shell.bat` or `mingw64_shell.bat` from wherever you installed
72 MYSY2 (i.e. `C:\msys`), depending on whether you want 32-bit or 64-bit Rust.
Luqman Aden8b833552014-06-27 00:07:4473
Kevin Yap24fa6be2015-02-21 22:46:06744. Navigate to Rust's source code, configure and build it:
75
76 ```sh
77 $ ./configure
78 $ make && make install
79 ```
Luqman Aden8b833552014-06-27 00:07:4480
Jack Moffitt8d64fa32013-07-18 23:27:4381## Notes
82
83Since the Rust compiler is written in Rust, it must be built by a
84precompiled "snapshot" version of itself (made in an earlier state of
85development). As such, source builds require a connection to the Internet, to
86fetch snapshots, and an OS that can execute the available snapshot binaries.
Austin Seipp62c4d2c2012-01-23 21:53:1287
Brian Anderson4c833af2012-10-11 00:56:3888Snapshot binaries are currently built and tested on several platforms:
Brian Anderson3403e412012-07-10 05:20:3289
Taylor Hutchison4474eab2014-10-10 04:41:3090* 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:0091* Linux (2.6.18 or later, various distributions), x86 and x86-64
Daniel Micayd2445122014-01-31 14:50:4492* OSX 10.7 (Lion) or greater, x86 and x86-64
Austin Seipp62c4d2c2012-01-23 21:53:1293
Adrien Tétara30d61b2014-01-11 14:19:3894You may find that other platforms work, but these are our officially
Brian Anderson4c833af2012-10-11 00:56:3895supported build environments that are most likely to work.
Austin Seipp62c4d2c2012-01-23 21:53:1296
Adrien Tétara30d61b2014-01-11 14:19:3897Rust currently needs about 1.5 GiB of RAM to build without swapping; if it hits
Jack Moffitt8d64fa32013-07-18 23:27:4398swap, it will take a very long time to build.
Brian Anderson4c833af2012-10-11 00:56:3899
Brian Andersonc2735712015-02-18 21:48:46100There is more advice about hacking on Rust in [CONTRIBUTING.md].
Austin Seipp62c4d2c2012-01-23 21:53:12101
Brian Andersonc2735712015-02-18 21:48:46102[CONTRIBUTING.md]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md
Austin Seipp62c4d2c2012-01-23 21:53:12103
Kevin Yap24fa6be2015-02-21 22:46:06104## Getting Help
Brian Andersoncd1fabe2014-08-22 18:04:35105
106The Rust community congregates in a few places:
107
Kevin Yap24fa6be2015-02-21 22:46:06108* [Stack Overflow] - Direct questions about using the language.
109* [users.rust-lang.org] - General discussion and broader questions.
Brian Anderson5716ede2015-01-29 23:49:00110* [/r/rust] - News and general discussion.
Brian Andersoncd1fabe2014-08-22 18:04:35111
Kevin Yap24fa6be2015-02-21 22:46:06112[Stack Overflow]: http://stackoverflow.com/questions/tagged/rust
Brian Andersoncd1fabe2014-08-22 18:04:35113[/r/rust]: http://reddit.com/r/rust
Brian Anderson5716ede2015-01-29 23:49:00114[users.rust-lang.org]: http://users.rust-lang.org/
Steve Klabnikf645cad2015-02-13 17:26:44115
116## Contributing
117
Daniel Lobato García13d5e572015-03-08 21:37:23118To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md).
Brian Andersoncd1fabe2014-08-22 18:04:35119
Brian Anderson46189552015-02-16 04:58:06120Rust has an [IRC] culture and most real-time collaboration happens in a
121variety of channels on Mozilla's IRC network, irc.mozilla.org. The
122most popular channel is [#rust], a venue for general discussion about
Kevin Yap24fa6be2015-02-21 22:46:06123Rust, and a good place to ask for help.
Brian Anderson46189552015-02-16 04:58:06124
125[IRC]: https://en.wikipedia.org/wiki/Internet_Relay_Chat
Brian Anderson7430e582015-02-18 21:46:20126[#rust]: irc://irc.mozilla.org/rust
Brian Anderson46189552015-02-16 04:58:06127
Brian Andersonc92d2ed2012-07-10 05:13:48128## License
Austin Seipp62c4d2c2012-01-23 21:53:12129
Brian Anderson11a99182012-12-28 21:40:33130Rust is primarily distributed under the terms of both the MIT license
131and the Apache License (Version 2.0), with portions covered by various
132BSD-like licenses.
Austin Seipp62c4d2c2012-01-23 21:53:12133
Daniel Lobato García13d5e572015-03-08 21:37:23134See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT), and [COPYRIGHT](COPYRIGHT) for details.