From 34436a91775e7930b6a78203084fcf62769b3e65 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Fri, 3 Jul 2026 11:22:05 +0200 Subject: [PATCH 1/3] [cmake] On a fresh configure, remove possibly outdated pcms. When CMake is run without an existing cache, or with cmake --fresh, remove leftover pcms the build directory. This can fix a build with broken pcms that don't get regenerated without needing to clean the entire build. --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7945ee63a3078..68354572d3301 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -469,6 +469,15 @@ if(MSVC) endif() if(runtime_cxxmodules) + if(NOT ROOT_CONFIGURED_FROM_CACHE) + # When using cmake --fresh (or changing the toolchain), remove possibly stale pcms that are not tracked by CMake + set(ROOT_CONFIGURED_FROM_CACHE True CACHE BOOL "Shows if ROOT is configured from an existing CMake cache") + mark_as_advanced(ROOT_CONFIGURED_FROM_CACHE) + file(GLOB_RECURSE left_over_pcms ${CMAKE_BINARY_DIR}/*.pcm) + if(left_over_pcms) + file(REMOVE ${left_over_pcms}) + endif() + endif() # Dummy target that does nothing, we don't need a PCH for modules. # Onepcm target has all dependencies needed for allDict.cxx.pch, which allow # to test hsimple.C after all C++ modules are updated. From 000884e66ad70144fa8aef134fa5ecdb97eb6ef0 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Mon, 6 Jul 2026 11:25:09 +0200 Subject: [PATCH 2/3] [CI] Always use cmake --fresh when configuring. Previously, the cmake configure step was skipped when a build cached existed. This increases the risk that a change in the underlying container or in ROOT's config options goes undetected, and might e.g. lead to broken pcms. (The external build options are hashed for the time being, so they are expected to wipe the build directory, but this can break any time the hashing is touched) Here, the logic is changed such that cmake configure always runs, and that pcms are wiped. This should fix the occasional problem with broken pcms, and ensures that the ROOT build reacts correctly to changes in the underlying container. --- .../workflows/root-ci-config/build_root.py | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/workflows/root-ci-config/build_root.py b/.github/workflows/root-ci-config/build_root.py index 9462d0f2ab36a..7305053a4af3f 100755 --- a/.github/workflows/root-ci-config/build_root.py +++ b/.github/workflows/root-ci-config/build_root.py @@ -413,26 +413,13 @@ def cmake_configure(options, buildtype): options = f"{options} -DROOT_COMPILEDATA_IGNORE_BUILD_NODE_CHANGES=ON" result = subprocess_with_log(f""" - cmake -S '{srcdir}' -B '{builddir}' -DCMAKE_BUILD_TYPE={buildtype} {options} + cmake --fresh -S '{srcdir}' -B '{builddir}' -DCMAKE_BUILD_TYPE={buildtype} {options} """) if result != 0: die(result, "Failed cmake generation step") -@github_log_group("Dump existing configuration") -def cmake_dump_config(): - # Print CMake cached config - srcdir = os.path.join(WORKDIR, "src") - builddir = os.path.join(WORKDIR, "build") - result = subprocess_with_log(f""" - cmake -S '{srcdir}' -B '{builddir}' -N -L - """) - - if result != 0: - die(result, "Failed cmake cache print step") - - @github_log_group("Dump requested build configuration") def dump_requested_config(options): print(f"\nBUILD OPTIONS: {options}") @@ -460,10 +447,7 @@ def build(options, buildtype): if result != 0: die(result, "Failed to create build directory") - if not os.path.exists(os.path.join(WORKDIR, "build", "CMakeCache.txt")): - cmake_configure(options, buildtype) - else: - cmake_dump_config() + cmake_configure(options, buildtype) dump_requested_config(options) From 17202cc8c269a236114fb40ab4c26f8063f3ee5e Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Mon, 6 Jul 2026 11:30:10 +0200 Subject: [PATCH 3/3] Make ruff happier with build_root.py --- .github/workflows/root-ci-config/build_root.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/root-ci-config/build_root.py b/.github/workflows/root-ci-config/build_root.py index 7305053a4af3f..14390ba90ea1d 100755 --- a/.github/workflows/root-ci-config/build_root.py +++ b/.github/workflows/root-ci-config/build_root.py @@ -59,7 +59,7 @@ def main(): # the target branch in the ROOT repository using base_ref and head_ref: # - The base_ref is e.g. "master" or "v6-38-00-patches" # - The head_ref for PRs is formatted as : e.g. "refs/pull/20742/head:cppyy_fixup" - if not ":" in args.head_ref: + if ":" not in args.head_ref: build_utils.print_error(f"This has been identified as a PR build. However, the head-ref is {args.head_ref}.") branch_in_fork = args.head_ref.split(":")[-1] if branch_in_fork == args.base_ref: @@ -85,7 +85,7 @@ def main(): if "minimal" in platform_options and platform_options["minimal"] == "ON": options_dict = platform_options - print(f"Minimal build detected in the platform options. Ignoring global configuration.") + print("Minimal build detected in the platform options. Ignoring global configuration.") else: options_dict.update(platform_options) print(f"Build option overrides for {args.platform_config}:")