Skip to content

Commit 6b23cc4

Browse files
committed
travis: Expand the cross linux image
This expands the `cross` travis matrix entry with a few more targets that our nightlies are building: * x86_64-rumprun-netbsd * arm-unknown-linux-musleabi * arm-unknown-linux-musleabihf * armv7-unknown-linux-musleabihf * mips-unknown-linux-musl * mipsel-unknown-linux-musl This commit doesn't compile custom toolchains like our current cross-image does, but instead compiles musl manually and then compiles libunwind manually (like x86_64) for use for the ARM targets and just uses openwrt toolchains for the mips targets.
1 parent 45b273a commit 6b23cc4

File tree

20 files changed

+243
-86
lines changed

20 files changed

+243
-86
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ osx_image: xcode8.2
1313
matrix:
1414
include:
1515
# Linux builders, all docker images
16-
- env: IMAGE=arm-android DEPLOY=1
16+
- env: IMAGE=android DEPLOY=1
1717
- env: IMAGE=cross DEPLOY=1
1818
- env: IMAGE=dist-arm-linux DEPLOY=1
1919
- env: IMAGE=dist-armv7-aarch64-linux DEPLOY=1

src/bootstrap/cc.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,14 @@ fn set_compiler(cfg: &mut gcc::Config,
121121
}
122122

123123
"mips-unknown-linux-musl" => {
124-
cfg.compiler("mips-linux-musl-gcc");
124+
if cfg.get_compiler().path().to_str() == Some("gcc") {
125+
cfg.compiler("mips-linux-musl-gcc");
126+
}
125127
}
126128
"mipsel-unknown-linux-musl" => {
127-
cfg.compiler("mipsel-linux-musl-gcc");
129+
if cfg.get_compiler().path().to_str() == Some("gcc") {
130+
cfg.compiler("mipsel-linux-musl-gcc");
131+
}
128132
}
129133

130134
t if t.contains("musl") => {

src/bootstrap/flags.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ To learn more about a subcommand, run `./x.py <command> -h`
287287
build: m.opt_str("build").unwrap_or_else(|| {
288288
env::var("BUILD").unwrap()
289289
}),
290-
host: m.opt_strs("host"),
291-
target: m.opt_strs("target"),
290+
host: split(m.opt_strs("host")),
291+
target: split(m.opt_strs("target")),
292292
config: cfg_file,
293293
src: m.opt_str("src").map(PathBuf::from),
294294
jobs: m.opt_str("jobs").map(|j| j.parse().unwrap()),
@@ -309,3 +309,7 @@ impl Subcommand {
309309
}
310310
}
311311
}
312+
313+
fn split(s: Vec<String>) -> Vec<String> {
314+
s.iter().flat_map(|s| s.split(',')).map(|s| s.to_string()).collect()
315+
}

src/ci/docker/arm-android/Dockerfile renamed to src/ci/docker/android/Dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,4 @@ ENV RUST_CONFIGURE_ARGS \
5353
# to all the targets above eventually.
5454
ENV SCRIPT \
5555
python2.7 ../x.py test --target arm-linux-androideabi && \
56-
python2.7 ../x.py dist \
57-
--target arm-linux-androideabi \
58-
--target armv7-linux-androideabi \
59-
--target i686-linux-android \
60-
--target aarch64-linux-android
56+
python2.7 ../x.py dist --target $TARGETS

src/ci/docker/cross/Dockerfile

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1010
git \
1111
cmake \
1212
sudo \
13-
xz-utils
13+
xz-utils \
14+
zlib1g-dev \
15+
g++-arm-linux-gnueabi \
16+
g++-arm-linux-gnueabihf \
17+
bzip2 \
18+
patch
1419

1520
ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783
1621
RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \
@@ -21,21 +26,50 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
2126
rm dumb-init_*.deb
2227
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
2328

29+
WORKDIR /tmp
30+
31+
COPY build-rumprun.sh /tmp/
32+
RUN ./build-rumprun.sh
33+
34+
COPY build-arm-musl.sh /tmp/
35+
RUN ./build-arm-musl.sh
36+
37+
# originally from
38+
# https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2
39+
RUN mkdir /usr/local/mips-linux-musl
40+
RUN curl -L https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2 | \
41+
tar xjf - -C /usr/local/mips-linux-musl --strip-components=2
42+
RUN for file in /usr/local/mips-linux-musl/bin/mips-openwrt-linux-*; do \
43+
ln -s $file /usr/local/bin/`basename $file`; \
44+
done
45+
46+
# Note that this originally came from:
47+
# https://downloads.openwrt.org/snapshots/trunk/malta/generic/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
48+
RUN mkdir /usr/local/mipsel-linux-musl
49+
RUN curl -L https://s3.amazonaws.com/rust-lang-ci/libc/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \
50+
tar xjf - -C /usr/local/mipsel-linux-musl --strip-components=2
51+
RUN for file in /usr/local/mipsel-linux-musl/bin/mipsel-openwrt-linux-*; do \
52+
ln -s $file /usr/local/bin/`basename $file`; \
53+
done
54+
2455
ENV TARGETS=asmjs-unknown-emscripten
2556
ENV TARGETS=$TARGETS,wasm32-unknown-emscripten
57+
ENV TARGETS=$TARGETS,x86_64-rumprun-netbsd
58+
ENV TARGETS=$TARGETS,mips-unknown-linux-musl
59+
ENV TARGETS=$TARGETS,mipsel-unknown-linux-musl
60+
ENV TARGETS=$TARGETS,arm-unknown-linux-musleabi
61+
ENV TARGETS=$TARGETS,arm-unknown-linux-musleabihf
62+
ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabihf
63+
64+
ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
65+
CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc
2666

27-
#ENV TARGETS=$TARGETS,mips-unknown-linux-musl
28-
#ENV TARGETS=$TARGETS,arm-unknown-linux-musleabi
29-
#ENV TARGETS=$TARGETS,arm-unknown-linux-musleabihf
30-
#ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabihf
31-
#ENV TARGETS=$TARGETS,x86_64-rumprun-netbsd
67+
# Suppress some warnings in the openwrt toolchains we downloaded
68+
ENV STAGING_DIR=/tmp
3269

3370
ENV RUST_CONFIGURE_ARGS \
3471
--target=$TARGETS \
35-
--enable-rustbuild
36-
37-
# Just a smoke test in dist to see if this works for now, we should expand this
38-
# to all the targets above eventually.
39-
ENV SCRIPT \
40-
python2.7 ../x.py build && \
41-
python2.7 ../x.py dist --target wasm32-unknown-emscripten
72+
--musl-root-arm=/usr/local/arm-linux-musleabi \
73+
--musl-root-armhf=/usr/local/arm-linux-musleabihf \
74+
--musl-root-armv7=/usr/local/armv7-linux-musleabihf
75+
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS

src/ci/docker/cross/build-arm-musl.sh

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#!/bin/sh
2+
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
set -ex
13+
14+
MUSL=1.1.16
15+
16+
curl -O https://www.musl-libc.org/releases/musl-$MUSL.tar.gz
17+
tar xf musl-$MUSL.tar.gz
18+
cd musl-$MUSL
19+
CC=arm-linux-gnueabi-gcc \
20+
CFLAGS="-march=armv6 -marm" \
21+
./configure \
22+
--prefix=/usr/local/arm-linux-musleabi \
23+
--enable-wrapper=gcc
24+
make -j$(nproc)
25+
make install
26+
cd ..
27+
rm -rf musl-$MUSL
28+
29+
tar xf musl-$MUSL.tar.gz
30+
cd musl-$MUSL
31+
CC=arm-linux-gnueabihf-gcc \
32+
CFLAGS="-march=armv6 -marm" \
33+
./configure \
34+
--prefix=/usr/local/arm-linux-musleabihf \
35+
--enable-wrapper=gcc
36+
make -j$(nproc)
37+
make install
38+
cd ..
39+
rm -rf musl-$MUSL
40+
41+
tar xf musl-$MUSL.tar.gz
42+
cd musl-$MUSL
43+
CC=arm-linux-gnueabihf-gcc \
44+
CFLAGS="-march=armv7-a" \
45+
./configure \
46+
--prefix=/usr/local/armv7-linux-musleabihf \
47+
--enable-wrapper=gcc
48+
make -j$(nproc)
49+
make install
50+
cd ..
51+
rm -rf musl-$MUSL*
52+
53+
ln -nsf ../arm-linux-musleabi/bin/musl-gcc /usr/local/bin/arm-linux-musleabi-gcc
54+
ln -nsf ../arm-linux-musleabihf/bin/musl-gcc /usr/local/bin/arm-linux-musleabihf-gcc
55+
ln -nsf ../armv7-linux-musleabihf/bin/musl-gcc /usr/local/bin/armv7-linux-musleabihf-gcc
56+
57+
58+
curl -L https://github.com/llvm-mirror/llvm/archive/release_39.tar.gz | tar xzf -
59+
curl -L https://github.com/llvm-mirror/libunwind/archive/release_39.tar.gz | tar xzf -
60+
61+
mkdir libunwind-build
62+
cd libunwind-build
63+
cmake ../libunwind-release_39 \
64+
-DLLVM_PATH=/tmp/llvm-release_39 \
65+
-DLIBUNWIND_ENABLE_SHARED=0 \
66+
-DCMAKE_C_COMPILER=arm-linux-gnueabi-gcc \
67+
-DCMAKE_CXX_COMPILER=arm-linux-gnueabi-g++ \
68+
-DCMAKE_C_FLAGS="-march=armv6 -marm" \
69+
-DCMAKE_CXX_FLAGS="-march=armv6 -marm"
70+
make -j$(nproc)
71+
cp lib/libunwind.a /usr/local/arm-linux-musleabi/lib
72+
cd ..
73+
rm -rf libunwind-build
74+
75+
mkdir libunwind-build
76+
cd libunwind-build
77+
cmake ../libunwind-release_39 \
78+
-DLLVM_PATH=/tmp/llvm-release_39 \
79+
-DLIBUNWIND_ENABLE_SHARED=0 \
80+
-DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \
81+
-DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \
82+
-DCMAKE_C_FLAGS="-march=armv6 -marm" \
83+
-DCMAKE_CXX_FLAGS="-march=armv6 -marm"
84+
make -j$(nproc)
85+
cp lib/libunwind.a /usr/local/arm-linux-musleabihf/lib
86+
cd ..
87+
rm -rf libunwind-build
88+
89+
mkdir libunwind-build
90+
cd libunwind-build
91+
cmake ../libunwind-release_39 \
92+
-DLLVM_PATH=/tmp/llvm-release_39 \
93+
-DLIBUNWIND_ENABLE_SHARED=0 \
94+
-DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \
95+
-DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \
96+
-DCMAKE_C_FLAGS="-march=armv7-a" \
97+
-DCMAKE_CXX_FLAGS="-march=armv7-a"
98+
make -j$(nproc)
99+
cp lib/libunwind.a /usr/local/armv7-linux-musleabihf/lib
100+
cd ..
101+
rm -rf libunwind-build
102+
103+
rm -rf libunwind-release_39
104+
rm -rf llvm-release_39

src/ci/docker/cross/build-rumprun.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
set -ex
13+
14+
hide_output() {
15+
set +x
16+
on_err="
17+
echo ERROR: An error was encountered with the build.
18+
cat /tmp/build.log
19+
exit 1
20+
"
21+
trap "$on_err" ERR
22+
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
23+
PING_LOOP_PID=$!
24+
$@ &> /tmp/build.log
25+
trap - ERR
26+
kill $PING_LOOP_PID
27+
rm /tmp/build.log
28+
set -x
29+
}
30+
31+
32+
git clone https://github.com/rumpkernel/rumprun
33+
cd rumprun
34+
git reset --hard 39a97f37a85e44c69b662f6b97b688fbe892603b
35+
git submodule update --init
36+
37+
CC=cc hide_output ./build-rr.sh -d /usr/local hw
38+
cd ..
39+
rm -rf rumprun

src/ci/docker/dist-arm-linux/Dockerfile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
2424
rm dumb-init_*.deb
2525
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
2626

27-
ENV RUST_CONFIGURE_ARGS \
28-
--host=arm-unknown-linux-gnueabi,arm-unknown-linux-gnueabihf
29-
ENV SCRIPT \
30-
python2.7 ../x.py dist \
31-
--host arm-unknown-linux-gnueabi \
32-
--target arm-unknown-linux-gnueabi \
33-
--host arm-unknown-linux-gnueabihf \
34-
--target arm-unknown-linux-gnueabihf
27+
ENV HOSTS=arm-unknown-linux-gnueabi
28+
ENV HOSTS=$HOSTS,arm-unknown-linux-gnueabihf
29+
30+
ENV RUST_CONFIGURE_ARGS --host=$HOSTS
31+
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

src/ci/docker/dist-armv7-aarch64-linux/Dockerfile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
2424
rm dumb-init_*.deb
2525
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
2626

27-
ENV RUST_CONFIGURE_ARGS \
28-
--host=armv7-unknown-linux-gnueabihf,aarch64-unknown-linux-gnu
29-
ENV SCRIPT \
30-
python2.7 ../x.py dist \
31-
--host armv7-unknown-linux-gnueabihf \
32-
--target armv7-unknown-linux-gnueabihf \
33-
--host aarch64-unknown-linux-gnu \
34-
--target aarch64-unknown-linux-gnu
27+
ENV HOSTS=armv7-unknown-linux-gnueabihf
28+
ENV HOSTS=$HOSTS,aarch64-unknown-linux-gnu
29+
30+
ENV RUST_CONFIGURE_ARGS --host=$HOSTS
31+
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

src/ci/docker/dist-freebsd/Dockerfile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@ ENV \
3535
CC_i686_unknown_freebsd=i686-unknown-freebsd10-gcc \
3636
CXX_i686_unknown_freebsd=i686-unknown-freebsd10-g++
3737

38-
ENV RUST_CONFIGURE_ARGS \
39-
--host=x86_64-unknown-freebsd,i686-unknown-freebsd
40-
ENV SCRIPT \
41-
python2.7 ../x.py dist \
42-
--host x86_64-unknown-freebsd \
43-
--target x86_64-unknown-freebsd \
44-
--host i686-unknown-freebsd \
45-
--target i686-unknown-freebsd
38+
ENV HOSTS=x86_64-unknown-freebsd
39+
ENV HOSTS=$HOSTS,i686-unknown-freebsd
40+
41+
ENV RUST_CONFIGURE_ARGS --host=$HOSTS
42+
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

src/ci/docker/dist-mips-linux/Dockerfile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
2424
rm dumb-init_*.deb
2525
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
2626

27-
ENV RUST_CONFIGURE_ARGS \
28-
--host=mips-unknown-linux-gnu,mipsel-unknown-linux-gnu
29-
ENV SCRIPT \
30-
python2.7 ../x.py dist \
31-
--host mips-unknown-linux-gnu \
32-
--target mips-unknown-linux-gnu \
33-
--host mipsel-unknown-linux-gnu \
34-
--target mipsel-unknown-linux-gnu
27+
ENV HOSTS=mips-unknown-linux-gnu
28+
ENV HOSTS=$HOSTS,mipsel-unknown-linux-gnu
29+
30+
ENV RUST_CONFIGURE_ARGS --host=$HOSTS
31+
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

src/ci/docker/dist-mips64-linux/Dockerfile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
2424
rm dumb-init_*.deb
2525
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
2626

27-
ENV RUST_CONFIGURE_ARGS \
28-
--host=mips64-unknown-linux-gnuabi64,mips64el-unknown-linux-gnuabi64
29-
ENV SCRIPT \
30-
python2.7 ../x.py dist \
31-
--host mips64-unknown-linux-gnuabi64 \
32-
--target mips64-unknown-linux-gnuabi64 \
33-
--host mips64el-unknown-linux-gnuabi64 \
34-
--target mips64el-unknown-linux-gnuabi64
27+
ENV HOSTS=mips64-unknown-linux-gnuabi64
28+
ENV HOSTS=$HOSTS,mips64el-unknown-linux-gnuabi64
29+
30+
ENV RUST_CONFIGURE_ARGS --host=$HOSTS
31+
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

src/ci/docker/dist-powerpc-linux/Dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
2323
rm dumb-init_*.deb
2424
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
2525

26-
ENV RUST_CONFIGURE_ARGS \
27-
--host=powerpc-unknown-linux-gnu
28-
ENV SCRIPT \
29-
python2.7 ../x.py dist \
30-
--host powerpc-unknown-linux-gnu \
31-
--target powerpc-unknown-linux-gnu
26+
ENV HOSTS=powerpc-unknown-linux-gnu
27+
28+
ENV RUST_CONFIGURE_ARGS --host=$HOSTS
29+
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
3230

3331
# FIXME(#36150) this will fail the bootstrap. Probably means something bad is
3432
# happening!

src/ci/docker/dist-powerpc64-linux/Dockerfile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@ ENV \
2929
CC_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-gcc \
3030
CXX_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-g++
3131

32-
ENV RUST_CONFIGURE_ARGS \
33-
--host=powerpc64-unknown-linux-gnu,powerpc64le-unknown-linux-gnu
34-
ENV SCRIPT \
35-
python2.7 ../x.py dist \
36-
--host powerpc64-unknown-linux-gnu \
37-
--target powerpc64-unknown-linux-gnu \
38-
--host powerpc64le-unknown-linux-gnu \
39-
--target powerpc64le-unknown-linux-gnu
32+
ENV HOSTS=powerpc64-unknown-linux-gnu
33+
ENV HOSTS=$HOSTS,powerpc64le-unknown-linux-gnu
34+
35+
ENV RUST_CONFIGURE_ARGS --host=$HOSTS
36+
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

0 commit comments

Comments
 (0)