Skip to content

Commit

Permalink
Auto merge of rust-lang#112049 - Kobzol:pgo-omit-benchmarks, r=<try>
Browse files Browse the repository at this point in the history
[do not merge] CI experiments

Various CI experiments for try/dist builds.

r? `@ghost`
  • Loading branch information
bors committed Jan 2, 2025
2 parents 6ca6659 + 2d9b030 commit a959394
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 9 deletions.
45 changes: 41 additions & 4 deletions src/bootstrap/src/core/build_steps/gcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use std::fs;
use std::path::PathBuf;
use std::sync::OnceLock;

use build_helper::ci::CiEnv;

use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
use crate::core::config::TargetSelection;
use crate::utils::exec::command;
Expand Down Expand Up @@ -112,16 +114,51 @@ impl Step for Gcc {
return true;
}

command(root.join("contrib/download_prerequisites")).current_dir(&root).run(builder);
command(root.join("configure"))
// GCC creates files (e.g. symlinks to the downloaded dependencies)
// in the source directory, which does not work with our CI setup, where we mount
// source directories as read-only on Linux.
// Therefore, as a part of the build in CI, we first copy the whole source directory
// to the build directory, and perform the build from there.
let src_dir = if CiEnv::is_ci() {
let src_dir = builder.gcc_out(target).join("src");
if src_dir.exists() {
builder.remove_dir(&src_dir);
}
builder.create_dir(&src_dir);
builder.cp_link_r(&root, &src_dir);
src_dir
} else {
root
};

command(src_dir.join("contrib/download_prerequisites")).current_dir(&src_dir).run(builder);
let mut configure_cmd = command(src_dir.join("configure"));
configure_cmd
.current_dir(&out_dir)
// On CI, we compile GCC with Clang.
// The -Wno-everything flag is needed to make GCC compile with Clang 19.
.env("CXXFLAGS", "-Wno-everything -O2")
.arg("--enable-host-shared")
.arg("--enable-languages=jit")
.arg("--enable-checking=release")
.arg("--disable-bootstrap")
.arg("--disable-multilib")
.arg(format!("--prefix={}", install_dir.display()))
.run(builder);
.arg(format!("--prefix={}", install_dir.display()));
let mut cc = builder.build.cc(target).display().to_string();
if let Some(ref ccache) = builder.build.config.ccache {
cc = format!("{ccache} {cc}");
}
configure_cmd.env("CC", cc);

if let Ok(ref cxx) = builder.build.cxx(target) {
let mut cxx = cxx.display().to_string();
if let Some(ref ccache) = builder.build.config.ccache {
cxx = format!("{ccache} {cxx}");
}
configure_cmd.env("CXX", cxx);
}
configure_cmd.run(builder);

command("make").current_dir(&out_dir).arg(format!("-j{}", builder.jobs())).run(builder);
command("make").current_dir(&out_dir).arg("install").run(builder);

Expand Down
7 changes: 2 additions & 5 deletions src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ RUN yum upgrade -y && \
python3 \
unzip \
wget \
flex \
xz \
zlib-devel.i686 \
zlib-devel.x86_64 \
Expand Down Expand Up @@ -92,11 +93,7 @@ ENV RUST_CONFIGURE_ARGS \
--set rust.codegen-units=1

# Note that `rust.debug` is set to true *only* for `opt-dist`
ENV SCRIPT python3 ../x.py build --set rust.debug=true opt-dist && \
./build/$HOSTS/stage0-tools-bin/opt-dist linux-ci -- python3 ../x.py dist \
--host $HOSTS --target $HOSTS \
--include-default-paths \
build-manifest bootstrap
ENV SCRIPT python3 ../x.py build gcc
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang

# This is the only builder which will create source tarballs
Expand Down
6 changes: 6 additions & 0 deletions src/ci/docker/host-x86_64/dist-x86_64-linux/build-zstd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,11 @@ cd zstd-$ZSTD
CFLAGS=-fPIC hide_output make -j$(nproc) VERBOSE=1
hide_output make install

# It doesn't seem to be possible to move destination directory
# of the `make install` above. We thus copy the built artifacts
# manually to our custom rustroot, so that it can be found through
# LD_LIBRARY_PATH.
cp /usr/local/lib/libzstd* /rustroot/lib64

cd ..
rm -rf zstd-$ZSTD
1 change: 1 addition & 0 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ try:
- image: dist-x86_64-linux
env:
CODEGEN_BACKENDS: llvm,cranelift
READ_ONLY_SRC: "0"
<<: *job-linux-16c

# Main CI jobs that have to be green to merge a commit into master
Expand Down

0 comments on commit a959394

Please sign in to comment.