1FROM ubuntu:16.10
2
3RUN apt-get update
4RUN apt-get install -y --no-install-recommends \
5  gcc make libc6-dev git curl ca-certificates
6# Below we're cross-compiling musl for i686 using the system compiler on an
7# x86_64 system. This is an awkward thing to be doing and so we have to jump
8# through a couple hoops to get musl to be happy. In particular:
9#
10# * We specifically pass -m32 in CFLAGS and override CC when running ./configure,
11#   since otherwise the script will fail to find a compiler.
12# * We manually unset CROSS_COMPILE when running make; otherwise the makefile
13#   will call the non-existent binary 'i686-ar'.
14RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
15    tar xzf - && \
16    cd musl-1.1.15 && \
17    CC=gcc CFLAGS=-m32 ./configure --prefix=/musl-i686 --disable-shared --target=i686 && \
18    make CROSS_COMPILE= install -j4 && \
19    cd .. && \
20    rm -rf musl-1.1.15
21ENV PATH=$PATH:/musl-i686/bin:/rust/bin \
22    CC_i686_unknown_linux_musl=musl-gcc
23