Rust on Windows

2013-10-08

The other day I wanted to try Rust on Windows but found it wasn't very straightforward.

I downloaded the GUI installer, clicked through it, typed rust, and got nothing but an exit code of -1073741515. Returning to the quick start I saw a note that I hadn't noticed the first time, mentioning that I need MinGW as well. But, which parts, and which version? It wasn't very clear to me.

So I've come up with this quick-start guide of my own, using Scoop. It makes use of Innounp to extract the contents of Rust's Inno Setup installer, thereby bypassing the UAC permissions popup and GUI stuff.

Here it is, my setup script to get started with Rust on Windows:

UPDATE: This script can be simplified now that Scoop auto-installs dependencies—just install Scoop and then run scoop install rust.

# from powershell 3...

# 1. install scoop
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

# 2. install Innounp to extract files from the Rust installer
scoop install innounp

# 3. install Rust and GCC 4.5 (from the MinGW project)
scoop install rust gcc45

Now when you type rust, you should see some helpful information about the commands you can use. You might want to check out the Rust tutorial at this stage.

Taking it Further: Building Rust on Windows

After I had Rust working, I wanted to see if I could improve on the guide to building it on Windows. I think what I came up with is slightly easier to follow, especially if you're new to MinGW / MSYS like I am.

Note: you don't need to do this if you just want to use Rust—this is only for when you want to hack on Rust itself.

scoop install gcc45 msys python27

msys
# a new MSYS command prompt should open: switch to that

# get the Rust source code
git clone git://github.com/mozilla/rust.git
cd rust

# make sure configure can find Python
export PATH=$PATH:~AppData/local/scoop/apps/python27/2.7.5

# these steps can take a while, and use ~2GB disk space
./configure
make
make install

# and you're done

I didn't have much time to play around with Rust after all that, but it looks interesting. I hope this guide makes it easier for someone else to try it out!