Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit de4ba24

Browse files
committedMar 12, 2025
Auto merge of #138395 - Kobzol:ci-download-gcc, r=<try>
Download GCC from CI on test builders This should reduce the duration of the `x86_64-gnu-llvm-18` job, which runs on PR CI, which is currently the only one that builds GCC (outside of the x64 dist builder). Since we handle the GCC download in the GCC step, and not eagerly in config, we can set this flag globally across all test builders, as it won't do anything unless they actually try to build GCC. Opening as a draft to test if it works on CI, because I still need to implement logic to avoid the download if there are any local modifications to GCC (essentially the "if-unchanged" mode, although I want to try something a bit different). r? `@ghost`
2 parents 0998d40 + 293a246 commit de4ba24

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed
 

‎config.example.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
# Note that this will attempt to download GCC even if there are local
172172
# modifications to the `src/gcc` submodule.
173173
# Currently, this is only supported for the `x86_64-unknown-linux-gnu` target.
174-
# download-ci-gcc = false
174+
#download-ci-gcc = false
175175

176176
# =============================================================================
177177
# General build configuration options

‎src/bootstrap/src/core/build_steps/gcc.rs

+15-7
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,23 @@ impl Step for Gcc {
6363
}
6464

6565
build_gcc(&metadata, builder, target);
66-
67-
let lib_alias = metadata.install_dir.join("lib/libgccjit.so.0");
68-
if !lib_alias.exists() {
69-
t!(builder.symlink_file(&libgccjit_path, lib_alias));
70-
}
66+
create_lib_alias(builder, &libgccjit_path);
7167

7268
t!(metadata.stamp.write());
7369

7470
GccOutput { libgccjit: libgccjit_path }
7571
}
7672
}
7773

74+
/// Creates a libgccjit.so.0 alias next to libgccjit.so if it does not
75+
/// already exist
76+
fn create_lib_alias(builder: &Builder<'_>, libgccjit: &PathBuf) {
77+
let lib_alias = libgccjit.parent().unwrap().join("libgccjit.so.0");
78+
if !lib_alias.exists() {
79+
t!(builder.symlink_file(libgccjit, lib_alias));
80+
}
81+
}
82+
7883
pub struct Meta {
7984
stamp: BuildStamp,
8085
out_dir: PathBuf,
@@ -109,8 +114,11 @@ fn try_download_gcc(builder: &Builder<'_>, target: TargetSelection) -> Option<Pa
109114
builder.config.download_ci_gcc(&sha, &root);
110115
t!(gcc_stamp.write());
111116
}
117+
112118
// FIXME: put libgccjit.so into a lib directory in dist::Gcc
113-
Some(root.join("libgccjit.so"))
119+
let libgccjit = root.join("libgccjit.so");
120+
create_lib_alias(builder, &libgccjit);
121+
Some(libgccjit)
114122
}
115123

116124
#[cfg(test)]
@@ -210,7 +218,7 @@ fn build_gcc(metadata: &Meta, builder: &Builder<'_>, target: TargetSelection) {
210218
.env("CXXFLAGS", "-Wno-everything -g -O2")
211219
.env("CFLAGS", "-Wno-everything -g -O2")
212220
.arg("--enable-host-shared")
213-
.arg("--enable-languages=jit")
221+
.arg("--enable-languages=c,jit,lto")
214222
.arg("--enable-checking=release")
215223
.arg("--disable-bootstrap")
216224
.arg("--disable-multilib")

‎src/ci/github-actions/jobs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ envs:
9090
# - not running `opt-dist`'s post-optimization smoke tests on the resulting toolchain
9191
#
9292
# If you *want* these to happen however, temporarily comment it before triggering a try build.
93-
DIST_TRY_BUILD: 1
93+
# DIST_TRY_BUILD: 1
9494

9595
auto:
9696
<<: *production

‎src/ci/run.sh

+3
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ else
180180
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set llvm.static-libstdcpp"
181181
fi
182182

183+
# Download GCC from CI on test builders
184+
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set gcc.download-ci-gcc=true"
185+
183186
if [ "$NO_DOWNLOAD_CI_RUSTC" = "" ]; then
184187
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.download-rustc=if-unchanged"
185188
fi

0 commit comments

Comments
 (0)
Failed to load comments.