1- FROM centos:5
1+ # We use Debian 6 (glibc 2.11, kernel 2.6.32) as a common base for other
2+ # distros that still need Rust support: RHEL 6 (glibc 2.12, kernel 2.6.32) and
3+ # SLES 11 SP4 (glibc 2.11, kernel 3.0).
4+ FROM debian:6
25
36WORKDIR /build
47
5- # Centos 5 is EOL and is no longer available from the usual mirrors, so switch
6- # to http://vault.centos.org/
7- RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
8- RUN sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
9- RUN sed -i 's|#\( baseurl.*\) mirror.centos.org/centos/$releasever|\1 vault.centos.org/5.11|' /etc/yum.repos.d/*.repo
8+ # Debian 6 is EOL and no longer available from the usual mirrors,
9+ # so we'll need to switch to http://archive.debian.org/
10+ RUN sed -i '/updates/d' /etc/apt/sources.list && \
11+ sed -i 's/httpredir/archive/' /etc/apt/sources.list
1012
11- RUN yum upgrade -y && yum install -y \
12- curl \
13+ RUN apt-get update && \
14+ apt-get install --allow-unauthenticated -y --no-install-recommends \
15+ automake \
1316 bzip2 \
17+ ca-certificates \
18+ curl \
19+ file \
20+ g++ \
21+ g++-multilib \
1422 gcc \
15- gcc-c++ \
23+ gcc-multilib \
24+ git \
25+ lib32z1-dev \
26+ libedit-dev \
27+ libncurses-dev \
1628 make \
17- glibc-devel \
29+ patch \
1830 perl \
19- zlib-devel \
20- file \
21- xz \
22- which \
23- pkgconfig \
31+ pkg-config \
32+ unzip \
2433 wget \
25- autoconf \
26- gettext
34+ xz-utils \
35+ zlib1g-dev
2736
2837ENV PATH=/rustroot/bin:$PATH
29- ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib
38+ ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib32:/rustroot/ lib
3039ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
3140WORKDIR /tmp
41+ RUN mkdir /home/user
3242COPY host-x86_64/dist-x86_64-linux/shared.sh /tmp/
3343
3444# We need a build of openssl which supports SNI to download artifacts from
@@ -38,14 +48,14 @@ COPY host-x86_64/dist-x86_64-linux/shared.sh /tmp/
3848COPY host-x86_64/dist-x86_64-linux/build-openssl.sh /tmp/
3949RUN ./build-openssl.sh
4050
41- # The `curl` binary on CentOS doesn't support SNI which is needed for fetching
51+ # The `curl` binary on Debian 6 doesn't support SNI which is needed for fetching
4252# some https urls we have, so install a new version of libcurl + curl which is
4353# using the openssl we just built previously.
4454#
4555# Note that we also disable a bunch of optional features of curl that we don't
4656# really need.
4757COPY host-x86_64/dist-x86_64-linux/build-curl.sh /tmp/
48- RUN ./build-curl.sh
58+ RUN ./build-curl.sh && apt-get remove -y curl
4959
5060# binutils < 2.22 has a bug where the 32-bit executables it generates
5161# immediately segfault in Rust, so we need to install our own binutils.
@@ -54,40 +64,24 @@ RUN ./build-curl.sh
5464COPY host-x86_64/dist-x86_64-linux/build-binutils.sh /tmp/
5565RUN ./build-binutils.sh
5666
57- # libssh2 (a dependency of Cargo) requires cmake 2.8.11 or higher but CentOS
58- # only has 2.6.4, so build our own
59- COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/
60- RUN ./build-cmake.sh
61-
62- # Need a newer version of gcc than centos has to compile LLVM nowadays
67+ # Need at least GCC 5.1 to compile LLVM nowadays
6368COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/
64- RUN ./build-gcc.sh
69+ RUN ./build-gcc.sh && apt-get remove -y gcc g++
6570
66- # CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+
71+ # Debian 6 has Python 2.6 by default, but LLVM needs 2.7+
6772COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/
6873RUN ./build-python.sh
6974
70- # Now build LLVM+Clang 7, afterwards configuring further compilations to use the
75+ # LLVM needs cmake 3.4.3 or higher, and is planning to raise to 3.13.4.
76+ COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/
77+ RUN ./build-cmake.sh
78+
79+ # Now build LLVM+Clang, afterwards configuring further compilations to use the
7180# clang/clang++ compilers.
72- COPY host-x86_64/dist-x86_64-linux/build-clang.sh host-x86_64/dist-x86_64-linux/llvm-project-centos.patch /tmp/
81+ COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/
7382RUN ./build-clang.sh
7483ENV CC=clang CXX=clang++
7584
76- # Apparently CentOS 5.5 desn't have `git` in yum, but we're gonna need it for
77- # cloning, so download and build it here.
78- COPY host-x86_64/dist-x86_64-linux/build-git.sh /tmp/
79- RUN ./build-git.sh
80-
81- # for sanitizers, we need kernel headers files newer than the ones CentOS ships
82- # with so we install newer ones here
83- COPY host-x86_64/dist-x86_64-linux/build-headers.sh /tmp/
84- RUN ./build-headers.sh
85-
86- # OpenSSL requires a more recent version of perl
87- # with so we install newer ones here
88- COPY host-x86_64/dist-x86_64-linux/build-perl.sh /tmp/
89- RUN ./build-perl.sh
90-
9185COPY scripts/sccache.sh /scripts/
9286RUN sh /scripts/sccache.sh
9387
@@ -117,4 +111,11 @@ ENV CFLAGS -mstackrealign
117111# libcurl, instead it should compile its own.
118112ENV LIBCURL_NO_PKG_CONFIG 1
119113
114+ # There was a bad interaction between "old" 32-bit binaries on current 64-bit
115+ # kernels with selinux enabled, where ASLR mmap would sometimes choose a low
116+ # address and then block it for being below `vm.mmap_min_addr` -> `EACCES`.
117+ # This is probably a kernel bug, but setting `ulimit -Hs` works around it.
118+ # See also `src/ci/run.sh` where this takes effect.
119+ ENV SET_HARD_RLIMIT_STACK 1
120+
120121ENV DIST_REQUIRE_ALL_TOOLS 1
0 commit comments