1 # We need recent curl, OpenSSL and CA certificates, so we can download further
2 # dependencies in the debian:6 image. We use an ubuntu 20.04 image download
5 RUN apt-get update && \
6 apt-get install -y --no-install-recommends \
10 COPY host-x86_64/dist-x86_64-linux/download-openssl-curl.sh /tmp/
11 RUN ./download-openssl-curl.sh
13 # We use Debian 6 (glibc 2.11, kernel 2.6.32) as a common base for other
14 # distros that still need Rust support: RHEL 6 (glibc 2.12, kernel 2.6.32) and
15 # SLES 11 SP4 (glibc 2.11, kernel 3.0).
20 # Debian 6 is EOL and no longer available from the usual mirrors,
21 # so we'll need to switch to http://archive.debian.org/
22 RUN sed -i '/updates/d' /etc/apt/sources.list && \
23 sed -i 's/httpredir/archive/' /etc/apt/sources.list
25 RUN apt-get update && \
26 apt-get install --allow-unauthenticated -y --no-install-recommends \
47 ENV PATH=/rustroot/bin:$PATH
48 ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib32:/rustroot/lib
49 ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
52 COPY host-x86_64/dist-x86_64-linux/shared.sh /tmp/
54 # We need a build of openssl which supports SNI to download artifacts from
55 # static.rust-lang.org. This'll be used to link into libcurl below (and used
56 # later as well), so build a copy of OpenSSL with dynamic libraries into our
58 COPY --from=0 /tmp/openssl.tar.gz /tmp/openssl.tar.gz
59 COPY host-x86_64/dist-x86_64-linux/build-openssl.sh /tmp/
60 RUN ./build-openssl.sh
62 # The `curl` binary on Debian 6 doesn't support SNI which is needed for fetching
63 # some https urls we have, so install a new version of libcurl + curl which is
64 # using the openssl we just built previously.
66 # Note that we also disable a bunch of optional features of curl that we don't
68 COPY --from=0 /tmp/curl.tar.xz /tmp/curl.tar.xz
69 COPY host-x86_64/dist-x86_64-linux/build-curl.sh /tmp/
72 # Use up-to-date curl CA bundle
73 COPY --from=0 /tmp/cacert.pem /tmp/cacert.pem
74 ENV CURL_CA_BUNDLE /tmp/cacert.pem
76 # binutils < 2.22 has a bug where the 32-bit executables it generates
77 # immediately segfault in Rust, so we need to install our own binutils.
79 # See https://github.com/rust-lang/rust/issues/20440 for more info
80 COPY host-x86_64/dist-x86_64-linux/build-binutils.sh /tmp/
81 RUN ./build-binutils.sh
83 # Need at least GCC 5.1 to compile LLVM nowadays
84 COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/
85 RUN ./build-gcc.sh && apt-get remove -y gcc g++
87 COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/
88 # Build Python 3 needed for LLVM 12.
89 RUN ./build-python.sh 3.9.1
91 # LLVM needs cmake 3.13.4 or higher.
92 COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/
95 # Now build LLVM+Clang, afterwards configuring further compilations to use the
96 # clang/clang++ compilers.
97 COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/
99 ENV CC=clang CXX=clang++
101 # rustc-perf version from 2022-05-18
102 ENV PERF_COMMIT f66cc8f3e04392b0e2fd811f21fd1ece6ebaded3
103 RUN curl -LS -o perf.zip https://github.com/rust-lang/rustc-perf/archive/$PERF_COMMIT.zip && \
105 mv rustc-perf-$PERF_COMMIT rustc-perf && \
108 COPY scripts/sccache.sh /scripts/
109 RUN sh /scripts/sccache.sh
111 ENV PGO_HOST=x86_64-unknown-linux-gnu
113 ENV HOSTS=x86_64-unknown-linux-gnu
115 ENV RUST_CONFIGURE_ARGS \
116 --enable-full-tools \
117 --enable-sanitizers \
119 --enable-compiler-docs \
120 --set target.x86_64-unknown-linux-gnu.linker=clang \
121 --set target.x86_64-unknown-linux-gnu.ar=/rustroot/bin/llvm-ar \
122 --set target.x86_64-unknown-linux-gnu.ranlib=/rustroot/bin/llvm-ranlib \
123 --set llvm.thin-lto=true \
124 --set llvm.ninja=false \
126 ENV SCRIPT ../src/ci/pgo.sh python3 ../x.py dist \
127 --host $HOSTS --target $HOSTS \
128 --include-default-paths \
130 ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang
132 # This is the only builder which will create source tarballs
135 # When we build cargo in this container, we don't want it to use the system
136 # libcurl, instead it should compile its own.
137 ENV LIBCURL_NO_PKG_CONFIG 1
139 ENV DIST_REQUIRE_ALL_TOOLS 1