WIP: Add PGO for apple darwin targets by osiewicz · Pull Request #140699 · rust-lang/rust (original) (raw)

info: removing rustup binaries
info: rustup is uninstalled
##[group]Image checksum input
mingw-check-tidy
# We use the ghcr base image because ghcr doesn't have a rate limit
# and the mingw-check-tidy job doesn't cache docker images in CI.
FROM ghcr.io/rust-lang/ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
  g++ \
---

COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 npm install eslint@$(head -n 1 /tmp/eslint.version) && \
 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
8.6.0#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#15 2.970 Building wheels for collected packages: reuse
#15 2.971   Building wheel for reuse (pyproject.toml): started
#15 3.199   Building wheel for reuse (pyproject.toml): finished with status 'done'
#15 3.200   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132719 sha256=d2a2565e7037ad3883fb9337653f2e25bbb588534fbef3697286cbc26d1bf634
#15 3.200   Stored in directory: /tmp/pip-ephem-wheel-cache-hoqcul9r/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#15 3.203 Successfully built reuse
#15 3.203 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#15 3.603 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#15 3.603 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#15 4.156 Collecting virtualenv
#15 4.192   Downloading virtualenv-20.31.2-py3-none-any.whl (6.1 MB)
#15 4.268      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.1/6.1 MB 82.5 MB/s eta 0:00:00
#15 4.327 Collecting filelock<4,>=3.12.2
#15 4.330   Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
#15 4.365 Collecting platformdirs<5,>=3.9.1
#15 4.367   Downloading platformdirs-4.3.8-py3-none-any.whl (18 kB)
#15 4.385 Collecting distlib<1,>=0.3.7
#15 4.388   Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#15 4.395      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 91.0 MB/s eta 0:00:00
#15 4.477 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#15 4.676 Successfully installed distlib-0.3.9 filelock-3.18.0 platformdirs-4.3.8 virtualenv-20.31.2
#15 4.676 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#15 DONE 4.8s

#16 [10/11] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#16 DONE 0.0s
---
DirectMap4k:      124864 kB
DirectMap2M:     9312256 kB
DirectMap1G:     9437184 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 npm install eslint@$(head -n 1 /tmp/eslint.version) &&  python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
+ head -n 1 /tmp/eslint.version
+ TIDY_PRINT_DIFF=1 npm install eslint@8.6.0
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated @humanwhocodes/config-array@0.9.5: Use @eslint/config-array instead
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm WARN deprecated @humanwhocodes/object-schema@1.2.1: Use @eslint/object-schema instead
npm WARN deprecated eslint@8.6.0: This version is no longer supported. Please see https://eslint.org/version-support for other options.

added 89 packages in 3s

17 packages are looking for funding
  run `npm fund` for details
+ python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.05s
##[endgroup]
WARN: currently no CI rustc builds have rustc debug assertions enabled. Please either set `rust.debug-assertions` to `false` if you want to use download CI rustc or set `rust.download-rustc` to `false`.
downloading https://static.rust-lang.org/dist/2025-05-27/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
---
##[endgroup]
[TIMING] core::build_steps::tool::ToolBuild { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, tool: "tidy", path: "src/tools/tidy", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "", cargo_args: [], artifact_kind: Binary } -- 36.137
[TIMING] core::build_steps::tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
Diff in /checkout/src/tools/opt-dist/src/main.rs:112:
     MacCi {
         #[clap(flatten)]
         shared: SharedArgs,
-    }
+    },
 }
 
 /// For a fast try build, we want to only build the bare minimum of components to get a
fmt: checked 6031 files
Diff in /checkout/src/bootstrap/src/core/build_steps/compile.rs:1395:
                 let clang_rt_dir = get_clang_cl_resource_dir(builder, clang_cl_path);
                 llvm_linker_flags.push_str(&format!("-L{}", clang_rt_dir.display()));
             }
-        } else  {
-
-            llvm_linker_flags.push_str("-L/opt/homebrew/Cellar/llvm/20.1.2/lib/clang/20/lib/darwin -lclang_rt.profile_osx");
-
+        } else {
+            llvm_linker_flags.push_str(
+                "-L/opt/homebrew/Cellar/llvm/20.1.2/lib/clang/20/lib/darwin -lclang_rt.profile_osx",
+            );
         }
-
     }
 
     // The config can also specify its own llvm linker flags.
Diff in /checkout/src/bootstrap/src/core/build_steps/llvm.rs:1038:
         // when doing PGO on CI, cmake or clang-cl don't automatically link clang's
         // profiler runtime in. In that case, we need to manually ask cmake to do it, to avoid
         // linking errors, much like LLVM's cmake setup does in that situation.
-        if builder.config.llvm_profile_generate  {
-            if target.is_msvc()  {
+        if builder.config.llvm_profile_generate {
+            if target.is_msvc() {
                 if let Some(clang_cl_path) = builder.config.llvm_clang_cl.as_ref() {
                     // Find clang's runtime library directory and push that as a search path to the
                     // cmake linker flags.
Diff in /checkout/src/bootstrap/src/core/build_steps/llvm.rs:1049:
             } else {
                 ldflags.push_all("-L/opt/homebrew/Cellar/llvm/20.1.2/lib/clang/20/lib/darwin -lclang_rt.profile_osx");
             }
-
         }
 
         // LLD is built as an LLVM tool, but is distributed outside of the `llvm-tools` component,