Skip to content

Commit 2968dde

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 + f43d076 commit 2968dde

File tree

6 files changed

+58
-112
lines changed

6 files changed

+58
-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: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,36 @@ 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+
# Temporary workaround: https://github.com/mstorsjo/llvm-mingw/issues/493
20+
mkdir -p $mingw_dir/bin
21+
ln -s aarch64-w64-windows-gnu.cfg $mingw_dir/bin/aarch64-pc-windows-gnu.cfg
22+
;;
23+
*x86_64-llvm*)
24+
mingw_dir="clang64"
25+
mingw_archive="${LLVM_MINGW_ARCHIVE_X86_64}"
26+
# Temporary workaround: https://github.com/mstorsjo/llvm-mingw/issues/493
27+
mkdir -p $mingw_dir/bin
28+
ln -s x86_64-w64-windows-gnu.cfg $mingw_dir/bin/x86_64-pc-windows-gnu.cfg
29+
;;
1430
*i686*)
15-
bits=32
31+
mingw_dir="mingw32"
1632
mingw_archive="${MINGW_ARCHIVE_32}"
1733
;;
1834
*x86_64*)
19-
bits=64
35+
mingw_dir="mingw64"
2036
mingw_archive="${MINGW_ARCHIVE_64}"
2137
;;
2238
*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}"
39+
echo "AArch64 Windows is not supported by GNU tools"
40+
exit 1
2741
;;
2842
*)
2943
echo "src/ci/scripts/install-mingw.sh can't detect the builder's architecture"
@@ -38,10 +52,21 @@ if isWindows && isKnownToBeMingwBuild; then
3852
msys2Path="c:/msys64"
3953
ciCommandAddPath "${msys2Path}/usr/bin"
4054

41-
mingw_dir="mingw${bits}"
55+
case "${mingw_archive}" in
56+
*.7z)
57+
curl -o mingw.7z "${MIRRORS_BASE}/${mingw_archive}"
58+
7z x -y mingw.7z > /dev/null
59+
;;
60+
*.zip)
61+
curl -o mingw.zip "${MIRRORS_BASE}/${mingw_archive}"
62+
unzip -d $mingw_dir mingw.zip > /dev/null
63+
;;
64+
*)
65+
echo "Unrecognized archive type"
66+
exit 1
67+
;;
68+
esac
4269

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

4772
# Initialize mingw for the user.

0 commit comments

Comments
 (0)