From 18f20439ddb7ecef55977b44d093be503c57d4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sat, 15 Jul 2023 08:59:59 +0200 Subject: [PATCH 1/2] CI: build CMake 3.20 to support LLVM 17 --- src/ci/docker/host-aarch64/aarch64-gnu/Dockerfile | 3 +++ src/ci/docker/host-x86_64/armhf-gnu/Dockerfile | 4 ++++ .../docker/host-x86_64/disabled/dist-m68k-linux/Dockerfile | 2 ++ .../docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile | 4 ++++ src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile | 3 +++ src/ci/docker/host-x86_64/dist-powerpc64le-linux/Dockerfile | 3 +++ src/ci/docker/host-x86_64/dist-various-1/Dockerfile | 3 +++ src/ci/docker/host-x86_64/dist-various-2/Dockerfile | 3 +++ src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile | 4 ++++ src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile | 3 +++ src/ci/docker/host-x86_64/test-various/Dockerfile | 3 +++ src/ci/docker/host-x86_64/wasm32/Dockerfile | 4 ++++ src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile | 3 +++ src/ci/docker/host-x86_64/x86_64-gnu-nopt/Dockerfile | 3 +++ src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile | 3 +++ src/ci/docker/scripts/cmake.sh | 6 +++--- 16 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/ci/docker/host-aarch64/aarch64-gnu/Dockerfile b/src/ci/docker/host-aarch64/aarch64-gnu/Dockerfile index 699938c3718..f8701044ec4 100644 --- a/src/ci/docker/host-aarch64/aarch64-gnu/Dockerfile +++ b/src/ci/docker/host-aarch64/aarch64-gnu/Dockerfile @@ -17,6 +17,9 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins xz-utils \ && rm -rf /var/lib/apt/lists/* +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/armhf-gnu/Dockerfile b/src/ci/docker/host-x86_64/armhf-gnu/Dockerfile index 57e63cd39d2..2d92d23d7b2 100644 --- a/src/ci/docker/host-x86_64/armhf-gnu/Dockerfile +++ b/src/ci/docker/host-x86_64/armhf-gnu/Dockerfile @@ -13,6 +13,7 @@ RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y --no- git \ libc6-dev \ libc6-dev-armhf-cross \ + libssl-dev \ make \ ninja-build \ python3 \ @@ -75,6 +76,9 @@ RUN arm-linux-gnueabihf-gcc addentropy.c -o rootfs/addentropy -static # Source of the file: https://github.com/vfdev-5/qemu-rpi2-vexpress/raw/master/vexpress-v2p-ca15-tc1.dtb RUN curl -O https://ci-mirrors.rust-lang.org/rustc/vexpress-v2p-ca15-tc1.dtb +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/disabled/dist-m68k-linux/Dockerfile b/src/ci/docker/host-x86_64/disabled/dist-m68k-linux/Dockerfile index 17203994cdf..cbac2310d0d 100644 --- a/src/ci/docker/host-x86_64/disabled/dist-m68k-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/disabled/dist-m68k-linux/Dockerfile @@ -16,6 +16,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libssl-dev \ pkg-config +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile b/src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile index 4377608700b..07260be3587 100644 --- a/src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile @@ -19,6 +19,7 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \ g++ \ libc6-dev \ libc6-dev-riscv64-cross \ + libssl-dev \ make \ ninja-build \ patch \ @@ -94,6 +95,9 @@ RUN mkdir build && cd build && \ WORKDIR /tmp RUN rm -rf /tmp/riscv-pk +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile index ea4a2a2427d..59e98689c2c 100644 --- a/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile @@ -48,6 +48,9 @@ COPY host-x86_64/dist-x86_64-linux/shared.sh /tmp/ COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/ RUN ./build-gcc.sh && yum remove -y gcc gcc-c++ +COPY scripts/cmake.sh /tmp/ +RUN ./cmake.sh + # Now build LLVM+Clang, afterwards configuring further compilations to use the # clang/clang++ compilers. COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/ diff --git a/src/ci/docker/host-x86_64/dist-powerpc64le-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-powerpc64le-linux/Dockerfile index 6b7b32a8bc7..2b2871c2ec0 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc64le-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-powerpc64le-linux/Dockerfile @@ -14,6 +14,9 @@ RUN apt-get install -y --no-install-recommends rpm2cpio cpio COPY host-x86_64/dist-powerpc64le-linux/shared.sh host-x86_64/dist-powerpc64le-linux/build-powerpc64le-toolchain.sh /tmp/ RUN ./build-powerpc64le-toolchain.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile index 4576e6d4fa2..c2abe9f19a3 100644 --- a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile @@ -186,6 +186,9 @@ ENV SCRIPT \ python3 ../x.py --stage 2 test --host='' --target $RUN_MAKE_TARGETS tests/run-make && \ python3 ../x.py dist --host='' --target $TARGETS +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + # sccache COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile index 0f5df95a0dd..6367aacfdde 100644 --- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile @@ -96,6 +96,9 @@ RUN /tmp/build-wasi-toolchain.sh COPY scripts/freebsd-toolchain.sh /tmp/ RUN /tmp/freebsd-toolchain.sh i686 +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile index c2fd2e3a91a..1afd8de7c87 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile @@ -48,6 +48,10 @@ COPY host-x86_64/dist-x86_64-linux/shared.sh /tmp/ COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/ RUN ./build-gcc.sh && yum remove -y gcc gcc-c++ +# LLVM 17 needs cmake 3.20 or higher. +COPY scripts/cmake.sh /tmp/ +RUN ./cmake.sh + # Now build LLVM+Clang, afterwards configuring further compilations to use the # clang/clang++ compilers. COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/ diff --git a/src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile index d03c364547e..041bacf3397 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile @@ -7,6 +7,9 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y zlib1g-dev COPY host-x86_64/dist-x86_64-netbsd/build-netbsd-toolchain.sh /tmp/ RUN /tmp/build-netbsd-toolchain.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile index 1dc7b798724..374d6921aba 100644 --- a/src/ci/docker/host-x86_64/test-various/Dockerfile +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile @@ -37,6 +37,9 @@ COPY scripts/musl-toolchain.sh /build/ RUN bash musl-toolchain.sh x86_64 && rm -rf build WORKDIR / +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/wasm32/Dockerfile b/src/ci/docker/host-x86_64/wasm32/Dockerfile index ef1fde1c3b9..0e8989e10f2 100644 --- a/src/ci/docker/host-x86_64/wasm32/Dockerfile +++ b/src/ci/docker/host-x86_64/wasm32/Dockerfile @@ -13,12 +13,16 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins sudo \ gdb \ xz-utils \ + libssl-dev \ bzip2 \ && rm -rf /var/lib/apt/lists/* COPY scripts/emscripten.sh /scripts/ RUN bash /scripts/emscripten.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile index 735d4d4dfcf..b404e3b982b 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile @@ -26,6 +26,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ clang \ && rm -rf /var/lib/apt/lists/* +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-nopt/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-nopt/Dockerfile index 9fdc78406fb..1452c00a5d8 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-nopt/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-nopt/Dockerfile @@ -18,6 +18,9 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins xz-utils \ && rm -rf /var/lib/apt/lists/* +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile index fbec368c9ee..576487821dc 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile @@ -19,6 +19,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ mingw-w64 \ && rm -rf /var/lib/apt/lists/* +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/scripts/cmake.sh b/src/ci/docker/scripts/cmake.sh index f124dbdaa6d..822666c8953 100755 --- a/src/ci/docker/scripts/cmake.sh +++ b/src/ci/docker/scripts/cmake.sh @@ -18,9 +18,9 @@ exit 1 set -x } -# LLVM 12 requires CMake 3.13.4 or higher. -# This script is not necessary for images using Ubuntu 20.04 or newer. -CMAKE=3.13.4 +# LLVM 17 requires CMake 3.20 or higher. +# This script is not necessary for images using Ubuntu 22.04 or newer. +CMAKE=3.20.3 curl -L https://github.com/Kitware/CMake/releases/download/v$CMAKE/cmake-$CMAKE.tar.gz | tar xzf - mkdir cmake-build From e95caa7b7276a9b7d57fb5cea544176d70623db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Mon, 17 Jul 2023 08:30:54 +0200 Subject: [PATCH 2/2] Link to `execinfo` on NetBSD --- compiler/rustc_llvm/build.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs index b0783d75d47..aa1121d6bb3 100644 --- a/compiler/rustc_llvm/build.rs +++ b/compiler/rustc_llvm/build.rs @@ -251,8 +251,11 @@ fn main() { } else if target.contains("windows-gnu") { println!("cargo:rustc-link-lib=shell32"); println!("cargo:rustc-link-lib=uuid"); - } else if target.contains("netbsd") || target.contains("haiku") || target.contains("darwin") { + } else if target.contains("haiku") || target.contains("darwin") { println!("cargo:rustc-link-lib=z"); + } else if target.contains("netbsd") { + println!("cargo:rustc-link-lib=z"); + println!("cargo:rustc-link-lib=execinfo"); } cmd.args(&components);