]> git.lizzy.rs Git - rust.git/blob - src/ci/docker/README.md
Auto merge of #65838 - estebank:resilient-recovery, r=Centril
[rust.git] / src / ci / docker / README.md
1 # Docker images for CI
2
3 This folder contains a bunch of docker images used by the continuous integration
4 (CI) of Rust. An script is accompanied (`run.sh`) with these images to actually
5 execute them. To test out an image execute:
6
7 ```
8 ./src/ci/docker/run.sh $image_name
9 ```
10
11 for example:
12
13 ```
14 ./src/ci/docker/run.sh x86_64-gnu
15 ```
16
17 Images will output artifacts in an `obj` dir at the root of a repository.
18
19 ## Filesystem layout
20
21 - Each directory, excluding `scripts` and `disabled`, corresponds to a docker image
22 - `scripts` contains files shared by docker images
23 - `disabled` contains images that are not built on CI
24
25 ## Docker Toolbox on Windows
26
27 For Windows before Windows 10, the docker images can be run on Windows via
28 [Docker Toolbox]. There are several preparation needs to be made before running
29 a Docker image.
30
31 1. Stop the virtual machine from the terminal with `docker-machine stop`
32
33 2. If your Rust source is placed outside of `C:\Users\**`, e.g. if you place the
34     repository in the `E:\rust` folder, please add a shared folder from
35     VirtualBox by:
36
37     1. Select the "default" virtual machine inside VirtualBox, then click
38         "Settings"
39     2. Go to "Shared Folders", click "Add shared folder" (the folder icon with
40         a plus sign), fill in the following information, then click "OK":
41
42         * Folder path: `E:\rust`
43         * Folder name: `e/rust`
44         * Read-only: ☐ *unchecked*
45         * Auto-mount: ☑ *checked*
46         * Make Permanent: ☑ *checked*
47
48 3. VirtualBox might not support creating symbolic links inside a shared folder
49     by default. You can enable it manually by running these from `cmd.exe`:
50
51     ```bat
52     cd "C:\Program Files\Oracle\VirtualBox"
53     VBoxManage setextradata default VBoxInternal2/SharedFoldersEnableSymlinksCreate/e/rust 1
54     ::                                                                              ^~~~~~
55     ::                                                                              folder name
56     ```
57
58 4. Restart the virtual machine from terminal with `docker-machine start`.
59
60 To run the image,
61
62 1. Launch the "Docker Quickstart Terminal".
63 2. Execute `./src/ci/docker/run.sh $image_name` as explained at the beginning.
64
65 [Docker Toolbox]: https://www.docker.com/products/docker-toolbox
66
67 ## Cross toolchains
68
69 A number of these images take quite a long time to compile as they're building
70 whole gcc toolchains to do cross builds with. Much of this is relatively
71 self-explanatory but some images use [crosstool-ng] which isn't quite as self
72 explanatory. Below is a description of where these `*.config` files come form,
73 how to generate them, and how the existing ones were generated.
74
75 [crosstool-ng]: https://github.com/crosstool-ng/crosstool-ng
76
77 ### Generating a `.config` file
78
79 If you have a `linux-cross` image lying around you can use that and skip the
80 next two steps.
81
82 - First we spin up a container and copy `build_toolchain_root.sh` into it. All
83   these steps are outside the container:
84
85 ```
86 # Note: We use ubuntu:15.10 because that's the "base" of linux-cross Docker
87 # image
88 $ docker run -it ubuntu:15.10 bash
89 $ docker ps
90 CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
91 cfbec05ed730        ubuntu:15.10        "bash"              16 seconds ago      Up 15 seconds                           drunk_murdock
92 $ docker cp build_toolchain_root.sh drunk_murdock:/
93 ```
94
95 - Then inside the container we build crosstool-ng by simply calling the bash
96   script we copied in the previous step:
97
98 ```
99 $ bash build_toolchain_root.sh
100 ```
101
102 - Now, inside the container run the following command to configure the
103   toolchain. To get a clue of which options need to be changed check the next
104   section and come back.
105
106 ```
107 $ ct-ng menuconfig
108 ```
109
110 - Finally, we retrieve the `.config` file from the container and give it a
111   meaningful name. This is done outside the container.
112
113 ```
114 $ docker drunk_murdock:/.config arm-linux-gnueabi.config
115 ```
116
117 - Now you can shutdown the container or repeat the two last steps to generate a
118   new `.config` file.
119
120 ### Toolchain configuration
121
122 Changes on top of the default toolchain configuration used to generate the
123 `.config` files in this directory. The changes are formatted as follows:
124
125 ```
126 $category > $option = $value -- $comment
127 ```
128
129 ### `arm-linux-gnueabi.config`
130
131 For targets: `arm-unknown-linux-gnueabi`
132
133 - Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
134 - Path and misc options > Patches origin = Bundled, then local
135 - Path and misc options > Local patch directory = /tmp/patches
136 - Target options > Target Architecture = arm
137 - Target options > Architecture level = armv6 -- (+)
138 - Target options > Floating point = software (no FPU) -- (\*)
139 - Operating System > Target OS = linux
140 - Operating System > Linux kernel version = 3.2.72 -- Precise kernel
141 - C-library > glibc version = 2.16.0
142 - C compiler > gcc version = 5.2.0
143 - C compiler > C++ = ENABLE -- to cross compile LLVM
144
145 ### `arm-linux-gnueabihf.config`
146
147 For targets: `arm-unknown-linux-gnueabihf`
148
149 - Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
150 - Path and misc options > Patches origin = Bundled, then local
151 - Path and misc options > Local patch directory = /tmp/patches
152 - Target options > Target Architecture = arm
153 - Target options > Architecture level = armv6 -- (+)
154 - Target options > Use specific FPU = vfp -- (+)
155 - Target options > Floating point = hardware (FPU) -- (\*)
156 - Target options > Default instruction set mode = arm -- (+)
157 - Operating System > Target OS = linux
158 - Operating System > Linux kernel version = 3.2.72 -- Precise kernel
159 - C-library > glibc version = 2.16.0
160 - C compiler > gcc version = 5.2.0
161 - C compiler > C++ = ENABLE -- to cross compile LLVM
162
163 ### `armv7-linux-gnueabihf.config`
164
165 For targets: `armv7-unknown-linux-gnueabihf`
166
167 - Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
168 - Path and misc options > Patches origin = Bundled only
169 - Target options > Target Architecture = arm
170 - Target options > Suffix to the arch-part = v7
171 - Target options > Architecture level = armv7-a -- (+)
172 - Target options > Use specific FPU = vfpv3-d16 -- (\*)
173 - Target options > Floating point = hardware (FPU) -- (\*)
174 - Target options > Default instruction set mode = thumb -- (\*)
175 - Operating System > Target OS = linux
176 - Operating System > Linux kernel version = 3.2.101
177 - C-library > glibc version = 2.17.0
178 - C compiler > gcc version = 8.3.0
179 - C compiler > C++ = ENABLE -- to cross compile LLVM
180
181 (\*) These options have been selected to match the configuration of the arm
182       toolchains shipped with Ubuntu 15.10
183 (+) These options have been selected to match the gcc flags we use to compile C
184     libraries like jemalloc. See the mk/cfg/arm(v7)-uknown-linux-gnueabi{,hf}.mk
185     file in Rust's source code.
186
187 ### `aarch64-linux-gnu.config`
188
189 For targets: `aarch64-unknown-linux-gnu`
190
191 - Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
192 - Target options > Target Architecture = arm
193 - Target options > Bitness = 64-bit
194 - Operating System > Target OS = linux
195 - Operating System > Linux kernel version = 4.2.6
196 - C-library > glibc version = 2.17 -- aarch64 support was introduced in this version
197 - C compiler > gcc version = 5.2.0
198 - C compiler > C++ = ENABLE -- to cross compile LLVM
199
200 ### `powerpc-linux-gnu.config`
201
202 For targets: `powerpc-unknown-linux-gnu`
203
204 - Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
205 - Path and misc options > Patches origin = Bundled, then local
206 - Path and misc options > Local patch directory = /tmp/patches
207 - Target options > Target Architecture = powerpc
208 - Target options > Emit assembly for CPU = powerpc -- pure 32-bit PowerPC
209 - Operating System > Target OS = linux
210 - Operating System > Linux kernel version = 2.6.32.68 -- ~RHEL6 kernel
211 - C-library > glibc version = 2.12.2 -- ~RHEL6 glibc
212 - C compiler > gcc version = 5.2.0
213 - C compiler > C++ = ENABLE -- to cross compile LLVM
214
215 ### `powerpc64-linux-gnu.config`
216
217 For targets: `powerpc64-unknown-linux-gnu`
218
219 - Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
220 - Path and misc options > Patches origin = Bundled, then local
221 - Path and misc options > Local patch directory = /tmp/patches
222 - Target options > Target Architecture = powerpc
223 - Target options > Bitness = 64-bit
224 - Target options > Emit assembly for CPU = power4 -- (+)
225 - Target options > Tune for CPU = power6 -- (+)
226 - Operating System > Target OS = linux
227 - Operating System > Linux kernel version = 2.6.32.68 -- ~RHEL6 kernel
228 - C-library > glibc version = 2.12.2 -- ~RHEL6 glibc
229 - C compiler > gcc version = 5.2.0
230 - C compiler > C++ = ENABLE -- to cross compile LLVM
231
232 (+) These CPU options match the configuration of the toolchains in RHEL6.
233
234 ### `s390x-linux-gnu.config`
235
236 For targets: `s390x-unknown-linux-gnu`
237
238 - Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
239 - Path and misc options > Patches origin = Bundled, then local
240 - Path and misc options > Local patch directory = /tmp/patches
241 - Target options > Target Architecture = s390
242 - Target options > Bitness = 64-bit
243 - Operating System > Target OS = linux
244 - Operating System > Linux kernel version = 2.6.32.68 -- ~RHEL6 kernel
245 - C-library > glibc version = 2.12.2 -- ~RHEL6 glibc
246 - C compiler > gcc version = 5.2.0
247 - C compiler > gcc extra config = --with-arch=z10 -- LLVM's minimum support
248 - C compiler > C++ = ENABLE -- to cross compile LLVM