Skip to content

Commit 2bf0de0

Browse files
Auto merge of #148751 - mati865:gnullvm-windows-host, r=<try>
Build gnullvm toolchains on Windows natively try-job: dist-aarch64-llvm-mingw try-job: dist-x86_64-llvm-mingw try-job: dist-x86_64-mingw
2 parents 2636cb4 + ad462aa commit 2bf0de0

File tree

6 files changed

+57
-112
lines changed

6 files changed

+57
-112
lines changed

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ fn runtime_dll_dist(rust_root: &Path, target: TargetSelection, builder: &Builder
300300
return;
301301
}
302302

303-
let (bin_path, libs_path) = get_cc_search_dirs(target, builder);
303+
let (bin_path, _) = get_cc_search_dirs(target, builder);
304304

305305
let mut rustc_dlls = vec![];
306306
// windows-gnu and windows-gnullvm require different runtime libs
@@ -316,15 +316,6 @@ fn runtime_dll_dist(rust_root: &Path, target: TargetSelection, builder: &Builder
316316
} else {
317317
panic!("Vendoring of runtime DLLs for `{target}` is not supported`");
318318
}
319-
// FIXME(#144656): Remove this whole `let ...`
320-
let bin_path = if target.ends_with("windows-gnullvm") && builder.host_target != target {
321-
bin_path
322-
.into_iter()
323-
.chain(libs_path.iter().map(|path| path.with_file_name("bin")))
324-
.collect()
325-
} else {
326-
bin_path
327-
};
328319
let rustc_dlls = find_files(&rustc_dlls, &bin_path);
329320

330321
// Copy runtime dlls next to rustc.exe
@@ -1824,8 +1815,7 @@ impl Step for Extended {
18241815
cmd.run(builder);
18251816
}
18261817

1827-
// FIXME(mati865): `gnullvm` here is temporary, remove it once it can host itself
1828-
if target.is_windows() && !target.contains("gnullvm") {
1818+
if target.is_windows() {
18291819
let exe = tmp.join("exe");
18301820
let _ = fs::remove_dir_all(&exe);
18311821

src/ci/docker/host-x86_64/dist-aarch64-windows-gnullvm/Dockerfile

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/ci/docker/host-x86_64/dist-x86_64-windows-gnullvm/Dockerfile

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/ci/docker/host-x86_64/dist-x86_64-windows-gnullvm/install-llvm-mingw.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/ci/github-actions/jobs.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,6 @@ auto:
247247
- name: dist-s390x-linux
248248
<<: *job-linux-4c
249249

250-
- name: dist-aarch64-windows-gnullvm
251-
<<: *job-linux-4c
252-
253-
- name: dist-x86_64-windows-gnullvm
254-
<<: *job-linux-4c
255-
256250
- name: dist-various-1
257251
<<: *job-linux-4c
258252

@@ -689,6 +683,28 @@ auto:
689683
CODEGEN_BACKENDS: llvm,cranelift
690684
<<: *job-windows
691685

686+
- name: dist-aarch64-llvm-mingw
687+
env:
688+
SCRIPT: python x.py dist bootstrap --include-default-paths
689+
RUST_CONFIGURE_ARGS: >-
690+
--build=aarch64-pc-windows-gnullvm
691+
--enable-full-tools
692+
--enable-profiler
693+
DIST_REQUIRE_ALL_TOOLS: 1
694+
CODEGEN_BACKENDS: llvm,cranelift
695+
<<: *job-windows
696+
697+
- name: dist-x86_64-llvm-mingw
698+
env:
699+
SCRIPT: python x.py dist bootstrap --include-default-paths
700+
RUST_CONFIGURE_ARGS: >-
701+
--build=x86_64-pc-windows-gnullvm
702+
--enable-full-tools
703+
--enable-profiler
704+
DIST_REQUIRE_ALL_TOOLS: 1
705+
CODEGEN_BACKENDS: llvm,cranelift
706+
<<: *job-windows
707+
692708
- name: dist-x86_64-msvc-alt
693709
env:
694710
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler

src/ci/scripts/install-mingw.sh

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,32 @@ source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
88

99
MINGW_ARCHIVE_32="i686-14.1.0-release-posix-dwarf-msvcrt-rt_v12-rev0.7z"
1010
MINGW_ARCHIVE_64="x86_64-14.1.0-release-posix-seh-msvcrt-rt_v12-rev0.7z"
11+
LLVM_MINGW_ARCHIVE_AARCH64="llvm-mingw-20251104-ucrt-aarch64.zip"
12+
LLVM_MINGW_ARCHIVE_X86_64="llvm-mingw-20251104-ucrt-x86_64.zip"
1113

1214
if isWindows && isKnownToBeMingwBuild; then
1315
case "${CI_JOB_NAME}" in
16+
*aarch64-llvm*)
17+
mingw_dir="clangarm64"
18+
mingw_archive="${LLVM_MINGW_ARCHIVE_AARCH64}"
19+
arch="aarch64"
20+
;;
21+
*x86_64-llvm*)
22+
mingw_dir="clang64"
23+
mingw_archive="${LLVM_MINGW_ARCHIVE_X86_64}"
24+
arch="x86_64"
25+
;;
1426
*i686*)
15-
bits=32
27+
mingw_dir="mingw32"
1628
mingw_archive="${MINGW_ARCHIVE_32}"
1729
;;
1830
*x86_64*)
19-
bits=64
31+
mingw_dir="mingw64"
2032
mingw_archive="${MINGW_ARCHIVE_64}"
2133
;;
2234
*aarch64*)
23-
# aarch64 is a cross-compiled target. Use the x86_64
24-
# mingw, since that's the host architecture.
25-
bits=64
26-
mingw_archive="${MINGW_ARCHIVE_64}"
35+
echo "AArch64 Windows is not supported by GNU tools"
36+
exit 1
2737
;;
2838
*)
2939
echo "src/ci/scripts/install-mingw.sh can't detect the builder's architecture"
@@ -38,10 +48,24 @@ if isWindows && isKnownToBeMingwBuild; then
3848
msys2Path="c:/msys64"
3949
ciCommandAddPath "${msys2Path}/usr/bin"
4050

41-
mingw_dir="mingw${bits}"
51+
case "${mingw_archive}" in
52+
*.7z)
53+
curl -o mingw.7z "${MIRRORS_BASE}/${mingw_archive}"
54+
7z x -y mingw.7z > /dev/null
55+
;;
56+
*.zip)
57+
curl -o mingw.zip "${MIRRORS_BASE}/${mingw_archive}"
58+
unzip -d $mingw_dir mingw.zip > /dev/null
59+
# Temporary workaround: https://github.com/mstorsjo/llvm-mingw/issues/493
60+
mkdir -p $mingw_dir/bin
61+
ln -s $arch-w64-windows-gnu.cfg $mingw_dir/bin/$arch-pc-windows-gnu.cfg
62+
;;
63+
*)
64+
echo "Unrecognized archive type"
65+
exit 1
66+
;;
67+
esac
4268

43-
curl -o mingw.7z "${MIRRORS_BASE}/${mingw_archive}"
44-
7z x -y mingw.7z > /dev/null
4569
ciCommandAddPath "$(cygpath -m "$(pwd)/${mingw_dir}/bin")"
4670

4771
# Initialize mingw for the user.

0 commit comments

Comments
 (0)