Skip to content

Commit

Permalink
Auto merge of rust-lang#124850 - dpaoliello:clang2022, r=<try>
Browse files Browse the repository at this point in the history
Upgrade pre-built Clang used in MSVC and MacOS builds, move MSVC builds to Server 2022

Fixes rust-lang#92948

Example working MacOS and Windows builds: <https://github.com/rust-lang/rust/actions/runs/8989360201>

Using Server 2022 for AArch64 MSVC is blocked by <llvm/llvm-project#81849>. I'll see if I can work around the issue in a follow up PR.
  • Loading branch information
bors committed May 7, 2024
2 parents b923ea4 + 768e382 commit 00258dc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -ex

source shared.sh

# Try to keep the LLVM version here in sync with src/ci/scripts/install-clang.sh
LLVM=llvmorg-18.1.0

mkdir llvm-project
Expand Down
25 changes: 19 additions & 6 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ try:
env:
CODEGEN_BACKENDS: llvm,cranelift
<<: *job-linux-16c
- image: x86_64-msvc
env:
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
SCRIPT: make ci-msvc
<<: *job-windows-8c
- image: i686-msvc
env:
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
SCRIPT: make ci-msvc
<<: *job-windows-8c

# Main CI jobs that have to be green to merge a commit into master
# These jobs automatically inherit envs.auto, to avoid repeating
Expand Down Expand Up @@ -349,21 +359,21 @@ auto:
env:
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
SCRIPT: make ci-msvc
<<: *job-windows-2019-8c
<<: *job-windows-8c

- image: i686-msvc
env:
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
SCRIPT: make ci-msvc
<<: *job-windows-2019-8c
<<: *job-windows-8c

- image: x86_64-msvc-ext
env:
SCRIPT: python x.py --stage 2 test src/tools/cargotest src/tools/cargo && src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
HOST_TARGET: x86_64-pc-windows-msvc
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld --save-toolstates=/tmp/toolstate/toolstates.json
DEPLOY_TOOLSTATES_JSON: toolstates-windows.json
<<: *job-windows-2019-8c
<<: *job-windows-8c

# 32/64-bit MinGW builds.
#
Expand Down Expand Up @@ -414,7 +424,7 @@ auto:
--set rust.codegen-units=1
SCRIPT: python x.py build --set rust.debug=true opt-dist && PGO_HOST=x86_64-pc-windows-msvc ./build/x86_64-pc-windows-msvc/stage0-tools-bin/opt-dist windows-ci -- python x.py dist bootstrap --include-default-paths
DIST_REQUIRE_ALL_TOOLS: 1
<<: *job-windows-2019-8c
<<: *job-windows-8c

- image: dist-i686-msvc
env:
Expand All @@ -426,8 +436,11 @@ auto:
--enable-profiler
SCRIPT: python x.py dist bootstrap --include-default-paths
DIST_REQUIRE_ALL_TOOLS: 1
<<: *job-windows-2019-8c
<<: *job-windows-8c

# FIXME: There is a Clang bug that prevents using the VS 2022 STL when
# building for ARM64: https://github.com/llvm/llvm-project/pull/81849
# This is fixed in LLVM 19, but can't be backported to LLVM 18.
- image: dist-aarch64-msvc
env:
RUST_CONFIGURE_ARGS: >-
Expand Down Expand Up @@ -471,4 +484,4 @@ auto:
env:
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
SCRIPT: python x.py dist bootstrap --include-default-paths
<<: *job-windows-2019-8c
<<: *job-windows-8c
16 changes: 11 additions & 5 deletions src/ci/scripts/install-clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,24 @@ IFS=$'\n\t'
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"

# Update both macOS's and Windows's tarballs when bumping the version here.
LLVM_VERSION="14.0.5"
# Try to keep this in sync with src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh
LLVM_VERSION="18.1.4"

if isMacOS; then
# FIXME: This is the latest pre-built version of LLVM that's available for
# x86_64 MacOS. We may want to consider bulding our own LLVM binaries
# instead, or set `USE_XCODE_CLANG` like AArch64 does.
LLVM_VERSION="15.0.7"

# If the job selects a specific Xcode version, use that instead of
# downloading our own version.
if [[ ${USE_XCODE_CLANG-0} -eq 1 ]]; then
bindir="$(xcode-select --print-path)/Toolchains/XcodeDefault.xctoolchain/usr/bin"
else
file="${MIRRORS_BASE}/clang%2Bllvm-${LLVM_VERSION}-x86_64-apple-darwin.tar.xz"
retry curl -f "${file}" -o "clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin.tar.xz"
tar xJf "clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin.tar.xz"
bindir="$(pwd)/clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin/bin"
file="${MIRRORS_BASE}/clang%2Bllvm-${LLVM_VERSION}-x86_64-apple-darwin21.0.tar.xz"
retry curl -f "${file}" -o "clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin21.0.tar.xz"
tar xJf "clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin21.0.tar.xz"
bindir="$(pwd)/clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin21.0/bin"
fi

ciCommandSetEnv CC "${bindir}/clang"
Expand Down

0 comments on commit 00258dc

Please sign in to comment.