Skip to content

Commit f55680d

Browse files
authored
Unrolled build for #148751
Rollup merge of #148751 - mati865:gnullvm-windows-host, r=marcoieni Build gnullvm toolchains on Windows natively Fixes #144656
2 parents c797096 + ab169ed commit f55680d

File tree

7 files changed

+97
-123
lines changed

7 files changed

+97
-123
lines changed

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

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ fn runtime_dll_dist(rust_root: &Path, target: TargetSelection, builder: &Builder
338338
return;
339339
}
340340

341-
let (bin_path, libs_path) = get_cc_search_dirs(target, builder);
341+
let (bin_path, _) = get_cc_search_dirs(target, builder);
342342

343343
let mut rustc_dlls = vec![];
344344
// windows-gnu and windows-gnullvm require different runtime libs
@@ -354,15 +354,6 @@ fn runtime_dll_dist(rust_root: &Path, target: TargetSelection, builder: &Builder
354354
} else {
355355
panic!("Vendoring of runtime DLLs for `{target}` is not supported`");
356356
}
357-
// FIXME(#144656): Remove this whole `let ...`
358-
let bin_path = if target.ends_with("windows-gnullvm") && builder.host_target != target {
359-
bin_path
360-
.into_iter()
361-
.chain(libs_path.iter().map(|path| path.with_file_name("bin")))
362-
.collect()
363-
} else {
364-
bin_path
365-
};
366357
let rustc_dlls = find_files(&rustc_dlls, &bin_path);
367358

368359
// Copy runtime dlls next to rustc.exe
@@ -1721,7 +1712,7 @@ impl Step for Extended {
17211712
tarballs.push(builder.ensure(Rustc { target_compiler }));
17221713
tarballs.push(builder.ensure(Std { build_compiler, target }).expect("missing std"));
17231714

1724-
if target.is_windows_gnu() {
1715+
if target.is_windows_gnu() || target.is_windows_gnullvm() {
17251716
tarballs.push(builder.ensure(Mingw { target }).expect("missing mingw"));
17261717
}
17271718

@@ -1868,8 +1859,7 @@ impl Step for Extended {
18681859
cmd.run(builder);
18691860
}
18701861

1871-
// FIXME(mati865): `gnullvm` here is temporary, remove it once it can host itself
1872-
if target.is_windows() && !target.contains("gnullvm") {
1862+
if target.is_windows() {
18731863
let exe = tmp.join("exe");
18741864
let _ = fs::remove_dir_all(&exe);
18751865

@@ -1907,7 +1897,7 @@ impl Step for Extended {
19071897
prepare(tool);
19081898
}
19091899
}
1910-
if target.is_windows_gnu() {
1900+
if target.is_windows_gnu() || target.is_windows_gnullvm() {
19111901
prepare("rust-mingw");
19121902
}
19131903

@@ -2072,7 +2062,7 @@ impl Step for Extended {
20722062
.arg("-t")
20732063
.arg(etc.join("msi/remove-duplicates.xsl"))
20742064
.run(builder);
2075-
if target.is_windows_gnu() {
2065+
if target.is_windows_gnu() || target.is_windows_gnullvm() {
20762066
command(&heat)
20772067
.current_dir(&exe)
20782068
.arg("dir")
@@ -2121,7 +2111,7 @@ impl Step for Extended {
21212111
if built_tools.contains("miri") {
21222112
cmd.arg("-dMiriDir=miri");
21232113
}
2124-
if target.is_windows_gnu() {
2114+
if target.is_windows_gnu() || target.is_windows_gnullvm() {
21252115
cmd.arg("-dGccDir=rust-mingw");
21262116
}
21272117
cmd.run(builder);
@@ -2149,7 +2139,7 @@ impl Step for Extended {
21492139
}
21502140
candle("AnalysisGroup.wxs".as_ref());
21512141

2152-
if target.is_windows_gnu() {
2142+
if target.is_windows_gnu() || target.is_windows_gnullvm() {
21532143
candle("GccGroup.wxs".as_ref());
21542144
}
21552145

@@ -2192,7 +2182,7 @@ impl Step for Extended {
21922182
cmd.arg("DocsGroup.wixobj");
21932183
}
21942184

2195-
if target.is_windows_gnu() {
2185+
if target.is_windows_gnu() || target.is_windows_gnullvm() {
21962186
cmd.arg("GccGroup.wixobj");
21972187
}
21982188
// ICE57 wrongly complains about the shortcuts
@@ -2231,7 +2221,7 @@ fn add_env(
22312221
.env("CFG_BUILD", target.triple)
22322222
.env("CFG_CHANNEL", &builder.config.channel);
22332223

2234-
if target.contains("windows-gnullvm") {
2224+
if target.is_windows_gnullvm() {
22352225
cmd.env("CFG_MINGW", "1").env("CFG_ABI", "LLVM");
22362226
} else if target.is_windows_gnu() {
22372227
cmd.env("CFG_MINGW", "1").env("CFG_ABI", "GNU");

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-aarch64
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: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,37 @@ 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 defaults to AArch64 MSVC which has a hard time building Ring crate
21+
# for citool. MSVC jobs install special Clang build to solve that, but here
22+
# it would be an overkill. So we just use toolchain that doesn't have this
23+
# issue.
24+
rustup default stable-aarch64-pc-windows-gnullvm
25+
;;
26+
*x86_64-llvm*)
27+
mingw_dir="clang64"
28+
mingw_archive="${LLVM_MINGW_ARCHIVE_X86_64}"
29+
arch="x86_64"
30+
;;
1431
*i686*)
15-
bits=32
32+
mingw_dir="mingw32"
1633
mingw_archive="${MINGW_ARCHIVE_32}"
1734
;;
1835
*x86_64*)
19-
bits=64
36+
mingw_dir="mingw64"
2037
mingw_archive="${MINGW_ARCHIVE_64}"
2138
;;
2239
*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}"
40+
echo "AArch64 Windows is not supported by GNU tools"
41+
exit 1
2742
;;
2843
*)
2944
echo "src/ci/scripts/install-mingw.sh can't detect the builder's architecture"
@@ -38,14 +53,32 @@ if isWindows && isKnownToBeMingwBuild; then
3853
msys2Path="c:/msys64"
3954
ciCommandAddPath "${msys2Path}/usr/bin"
4055

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

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

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 ' '
77+
# MSYS2 is not installed on AArch64 runners
78+
if [[ "${CI_JOB_NAME}" != *aarch64-llvm* ]]; then
79+
# Initialize mingw for the user.
80+
# This should be done by github but isn't for some reason.
81+
# (see https://github.com/actions/runner-images/issues/12600)
82+
/c/msys64/usr/bin/bash -lc ' '
83+
fi
5184
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)