• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# We document platform support for minimum glibc 2.17 and kernel 3.2.
2# CentOS 7 has headers for kernel 3.10, but that's fine as long as we don't
3# actually use newer APIs in rustc or std without a fallback. It's more
4# important that we match glibc for ELF symbol versioning.
5FROM centos:7
6
7WORKDIR /build
8
9RUN yum upgrade -y && \
10    yum install -y epel-release && \
11    yum install -y \
12      automake \
13      bzip2 \
14      file \
15      cmake3 \
16      gcc \
17      gcc-c++ \
18      git \
19      glibc-devel.i686 \
20      glibc-devel.x86_64 \
21      libedit-devel \
22      libstdc++-devel.i686 \
23      libstdc++-devel.x86_64 \
24      make \
25      ncurses-devel \
26      openssl-devel \
27      patch \
28      perl \
29      pkgconfig \
30      python3 \
31      unzip \
32      wget \
33      xz \
34      zlib-devel.i686 \
35      zlib-devel.x86_64 \
36      && yum clean all
37
38RUN mkdir -p /rustroot/bin && ln -s /usr/bin/cmake3 /rustroot/bin/cmake
39
40ENV PATH=/rustroot/bin:$PATH
41ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib32:/rustroot/lib
42ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
43WORKDIR /tmp
44RUN mkdir /home/user
45COPY host-x86_64/dist-x86_64-linux/shared.sh /tmp/
46
47# Need at least GCC 5.1 to compile LLVM nowadays
48COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/
49RUN ./build-gcc.sh && yum remove -y gcc gcc-c++
50
51# Now build LLVM+Clang, afterwards configuring further compilations to use the
52# clang/clang++ compilers.
53COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/
54RUN ./build-clang.sh
55ENV CC=clang CXX=clang++
56
57COPY scripts/sccache.sh /scripts/
58RUN sh /scripts/sccache.sh
59
60ENV HOSTS=i686-unknown-linux-gnu
61
62ENV RUST_CONFIGURE_ARGS \
63      --enable-full-tools \
64      --enable-sanitizers \
65      --enable-profiler \
66      --set target.i686-unknown-linux-gnu.linker=clang \
67      --build=i686-unknown-linux-gnu \
68      --set llvm.ninja=false \
69      --set rust.jemalloc
70ENV SCRIPT python3 ../x.py dist --build $HOSTS --host $HOSTS --target $HOSTS
71ENV CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=clang
72
73# This was added when we switched from gcc to clang. It's not clear why this is
74# needed unfortunately, but without this the stage1 bootstrap segfaults
75# somewhere inside of a build script. The build ends up just hanging instead of
76# actually killing the process that segfaulted, but if the process is run
77# manually in a debugger the segfault is immediately seen as well as the
78# misaligned stack access.
79#
80# Added in #50200 there's some more logs there
81ENV CFLAGS -mstackrealign
82
83# When we build cargo in this container, we don't want it to use the system
84# libcurl, instead it should compile its own.
85ENV LIBCURL_NO_PKG_CONFIG 1
86
87# There was a bad interaction between "old" 32-bit binaries on current 64-bit
88# kernels with selinux enabled, where ASLR mmap would sometimes choose a low
89# address and then block it for being below `vm.mmap_min_addr` -> `EACCES`.
90# This is probably a kernel bug, but setting `ulimit -Hs` works around it.
91# See also `src/ci/run.sh` where this takes effect.
92ENV SET_HARD_RLIMIT_STACK 1
93
94ENV DIST_REQUIRE_ALL_TOOLS 1
95