Skip to content

Commit 3fa136f

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
2 parents d6deffe + 0869a1f commit 3fa136f

File tree

7 files changed

+90
-117
lines changed

7 files changed

+90
-117
lines changed

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

Lines changed: 3 additions & 13 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

@@ -2188,7 +2178,7 @@ fn add_env(
21882178
.env("CFG_CHANNEL", &builder.config.channel);
21892179

21902180
if target.contains("windows-gnullvm") {
2191-
cmd.env("CFG_MINGW", "1").env("CFG_ABI", "LLVM");
2181+
cmd.env("CFG_MINGW", "0").env("CFG_ABI", "LLVM");
21922182
} else if target.is_windows_gnu() {
21932183
cmd.env("CFG_MINGW", "1").env("CFG_ABI", "GNU");
21942184
} else {

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: 24 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,30 @@ 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+
--enable-sanitizers
694+
DIST_REQUIRE_ALL_TOOLS: 1
695+
CODEGEN_BACKENDS: llvm,cranelift
696+
<<: *job-windows-aarch64
697+
698+
- name: dist-x86_64-llvm-mingw
699+
env:
700+
SCRIPT: python x.py dist bootstrap --include-default-paths
701+
RUST_CONFIGURE_ARGS: >-
702+
--build=x86_64-pc-windows-gnullvm
703+
--enable-full-tools
704+
--enable-profiler
705+
--enable-sanitizers
706+
DIST_REQUIRE_ALL_TOOLS: 1
707+
CODEGEN_BACKENDS: llvm,cranelift
708+
<<: *job-windows
709+
692710
- name: dist-x86_64-msvc-alt
693711
env:
694712
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler

src/ci/scripts/install-mingw.sh

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,34 @@ 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+
# Rustup default to AArch64 MSVC which has troubles building Ring crate
21+
rustup default stable-aarch64-pc-windows-gnullvm
22+
;;
23+
*x86_64-llvm*)
24+
mingw_dir="clang64"
25+
mingw_archive="${LLVM_MINGW_ARCHIVE_X86_64}"
26+
arch="x86_64"
27+
;;
1428
*i686*)
15-
bits=32
29+
mingw_dir="mingw32"
1630
mingw_archive="${MINGW_ARCHIVE_32}"
1731
;;
1832
*x86_64*)
19-
bits=64
33+
mingw_dir="mingw64"
2034
mingw_archive="${MINGW_ARCHIVE_64}"
2135
;;
2236
*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}"
37+
echo "AArch64 Windows is not supported by GNU tools"
38+
exit 1
2739
;;
2840
*)
2941
echo "src/ci/scripts/install-mingw.sh can't detect the builder's architecture"
@@ -38,14 +50,32 @@ if isWindows && isKnownToBeMingwBuild; then
3850
msys2Path="c:/msys64"
3951
ciCommandAddPath "${msys2Path}/usr/bin"
4052

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

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

47-
# Initialize mingw for the user.
48-
# This should be done by github but isn't for some reason.
49-
# (see https://github.com/actions/runner-images/issues/12600)
50-
/c/msys64/usr/bin/bash -lc ' '
74+
# MSYS2 is not installed on AArch64 runners
75+
if [[ "${CI_JOB_NAME}" != *aarch64-llvm* ]]; then
76+
# Initialize mingw for the user.
77+
# This should be done by github but isn't for some reason.
78+
# (see https://github.com/actions/runner-images/issues/12600)
79+
/c/msys64/usr/bin/bash -lc ' '
80+
fi
5181
fi

src/etc/installer/msi/rust.wxs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@
3838
<?elseif $(env.CFG_CHANNEL)="dev" ?>
3939
<?define UpgradeCode="231A9544-7E39-4A60-A069-0EB3CA4BAB2E" ?>
4040
<?endif ?>
41+
<?elseif $(env.CFG_ABI)="LLVM" ?>
42+
<?if $(env.CFG_CHANNEL)="stable" ?>
43+
<?define UpgradeCode="BA2B2E96-F3E2-4DE9-8809-38C31382CC96" ?>
44+
<?elseif $(env.CFG_CHANNEL)="beta" ?>
45+
<?define UpgradeCode="44A2D96F-6CF2-4ED9-AE05-7CF0C3A7D0D9" ?>
46+
<?elseif $(env.CFG_CHANNEL)="nightly" ?>
47+
<?define UpgradeCode="FB0EEAE4-13FB-46BB-86E8-F9D00E6DA364" ?>
48+
<?elseif $(env.CFG_CHANNEL)="dev" ?>
49+
<?define UpgradeCode="73C94FB8-266F-48DC-A23B-B6E5DBDCF508" ?>
50+
<?endif ?>
4151
<?endif ?>
4252
<?define PlatformProgramFilesFolder="ProgramFiles64Folder" ?>
4353
<?elseif $(sys.BUILDARCH)="x86" ?>
@@ -61,6 +71,16 @@
6171
<?elseif $(env.CFG_CHANNEL)="dev" ?>
6272
<?define UpgradeCode="87DFC303-6492-4E9B-911E-56EAD56C5E58" ?>
6373
<?endif ?>
74+
<?elseif $(env.CFG_ABI)="LLVM" ?>
75+
<?if $(env.CFG_CHANNEL)="stable" ?>
76+
<?define UpgradeCode="DB29CBDE-CDDF-4EC9-9C68-B6F00038EEDD" ?>
77+
<?elseif $(env.CFG_CHANNEL)="beta" ?>
78+
<?define UpgradeCode="AE1EF98B-1387-43BE-BE55-2310449D7E02" ?>
79+
<?elseif $(env.CFG_CHANNEL)="nightly" ?>
80+
<?define UpgradeCode="27B805BC-9C71-4198-A397-3082B1E708A7" ?>
81+
<?elseif $(env.CFG_CHANNEL)="dev" ?>
82+
<?define UpgradeCode="9DDD8D25-57C4-4410-AB35-A23A805AAD17" ?>
83+
<?endif ?>
6484
<?endif ?>
6585
<?define PlatformProgramFilesFolder="ProgramFilesFolder" ?>
6686
<?else ?>

0 commit comments

Comments
 (0)