forked from rustbridge/a-very-brief-intro-to-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installfest.html
183 lines (131 loc) · 4.07 KB
/
installfest.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<DOCTYPE html>
<html>
<head>
<title>Rustbridge Installfest</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link href="css/skeleton.css" type="text/css" rel="stylesheet">
<link href="css/custom.css" type="text/css" rel="stylesheet">
</head>
<body>
<textarea id="source">
class: middle,left
## Installfest!
* Goal: to make sure your computer is ready to go for tomorrow.
* You will install Rust and run a few more commands that will test what we need to have working.
* We will explain what all these commands do tomorrow!
* If at any point you get error messages or unexpected output, call someone over for help!
---
class: middle, left
## Install Rust
The best way to install Rust is with rustup, a Rust version manager.
Instructions are at [https://rustup.rs](https://www.rustup.rs/).
---
class: middle, left
## Check your installation
You should be able to run these two commands and get similar output as below:
* `rustc --version`
* Either: `rustc 1.12.0 (3191fbae9 2016-09-23)`
* Or: `rustc 1.12.1 (d4f39402a 2016-10-19)`
* `cargo --version`
* `cargo 0.13.0-nightly (109cb7c 2016-08-19)`
---
class: middle, left
## Check cargo
Go into a directory where you keep code and run:
```
cargo new --bin installtest
cd installtest
cargo run
```
You should see output that looks like this:
```
$ cargo run
Compiling installtest v0.1.0 (file:///projects/installtest)
Finished debug [unoptimized + debuginfo] target(s) in 0.46 secs
Running target/debug/installtest
Hello, world!
```
---
class: middle, left
## Check installing crates
In your `installtest` directory, edit `Cargo.toml` and add this line to the end:
```
hyper = "0.9.10"
```
Run `cargo run` again, and you should see output that looks like this:
```no-highlight
$ cargo run
Updating registry https://github.com/rust-lang/crates.io-index
Downloading gcc v0.3.37
Downloading [... a bunch more things ...]
Compiling typeable v0.1.2
Compiling [... a bunch more things ...]
Compiling installtest v0.1.0 (file:///projects/installtest)
Finished debug [unoptimized + debuginfo] target(s) in 32.0 secs
Running target/debug/installtest
Hello, world!
```
---
class: middle, left
# If that worked: You're done!!!!! 🎉 🎊 🌯 🎆
## If not, keep going to see some common issues and/or call someone over to help!
---
class: middle, left
## Common issue: openssl on osx
Symptom: After adding `hyper` and doing `cargo run`, you see:
```
failed to run custom build command for openssl-sys-extras v0.7.4
Process didn't exit successfully:
`/xxx/rust/hello/target/debug/build/openssl-sys-extras-413...
(exit code: 101)
[bunch of garbage]
```
---
class: middle, left
## Common issue: openssl on osx
Solution:
* Assuming you have homebrew, run `brew install openssl`
* Add to `~/.bash_profile`:
```
export OPENSSL_INCLUDE_DIR=$(brew --prefix openssl)/include
export DEP_OPENSSL_INCLUDE=${OPENSSL_INCLUDE_DIR}
```
* Run `source ~/.bash_profile`
* You won't have to do any of this again for new terminal sessions.
---
class: middle, left
## If github is down:
Create a directory named `.cargo` and make a file named `config` with these contents:
```toml
[source]
[source.mirror]
registry = 'https://gitlab.com/integer32llc/crates.io-index'
[source.crates-io]
replace-with = "mirror"
registry = 'http://must-be-present-but-doesnt-matter.com'
```
---
class: middle, left
## More useful `rustup` commands
Rustup makes it easy to have different versions of Rust installed and keep them
up to date. Rust has 3 release "channels": stable, beta, and nightly. New stable and beta versions come out every six weeks.
To update all channels you have installed, use:
```
rustup update
```
To show what versions you have installed, type:
```
rustup toolchain list
```
To switch which toolchain you're currently using, for example to switch to "nightly", type:
```
rustup default nightly
```
</textarea>
<script src="js/remark.js" type="text/javascript">
</script>
<script type="text/javascript">
var slideshow = remark.create();
</script>
</body>
</html>