Skip to content

Conversation

@ldionne
Copy link
Member

@ldionne ldionne commented Nov 7, 2025

Previously, the bootstrapping-build job defined in run-buildbot required the CC and CXX environment variables to be defined even though run-buildbot documents these environment variables as being optional. It also relied on ccache being available.

Refactor run-buildbot to make CC and CXX mandatory, and refactor various places in the CI where we called run-buildbot without setting CC and CXX. After this patch, all places that use run-buildbot are setting CC and CXX before calling the script, which makes it easier to track what compiler is used where. This also allows simplifying run-buildbot itself.

Finally, this patch makes ccache optional for running the bootstrapping build.

@ldionne ldionne requested a review from a team as a code owner November 7, 2025 00:31
Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it'd be better if we just require CC and CXX. These defaults are probably wrong on most systems. For the CCACHE part I'd be much happier if we don't use any unless the user explicitly sets CCACHE.

@ldionne ldionne added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Nov 8, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 8, 2025

@llvm/pr-subscribers-github-workflow

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

The bootstrapping-build job defined in run-buildbot required the CC and CXX environment variables to be defined even though run-buildbot documents these environment variables as being optional.

It also required ccache, which may not be available for local builds.

This patch tweaks the script slightly to better deal with the absence of these environment variables/tools.


Full diff: https://github.com/llvm/llvm-project/pull/166875.diff

1 Files Affected:

  • (modified) libcxx/utils/ci/run-buildbot (+20-7)
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 57ecf1e49dbf2..b7dcafaa3f68c 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -96,6 +96,14 @@ if [ -z "${CMAKE}" ]; then
     fi
 fi
 
+if [ -z "${CC}" ]; then
+    CC=cc
+fi
+
+if [ -z "${CXX}" ]; then
+    CXX=c++
+fi
+
 function step() {
   endstep
   set +x
@@ -121,6 +129,13 @@ function error() {
     echo "::error::$1"
 }
 
+# Print the version of a few tools to aid diagnostics in some cases
+step "Diagnose tools in use"
+${CMAKE} --version
+${NINJA} --version
+${CC} --version
+${CXX} --version
+
 function clean() {
     rm -rf "${BUILD_DIR}"
 }
@@ -240,12 +255,6 @@ function test-armv7m-picolibc() {
     check-runtimes
 }
 
-# Print the version of a few tools to aid diagnostics in some cases
-step "Diagnose tools in use"
-${CMAKE} --version
-${NINJA} --version
-if [ ! -z "${CXX}" ]; then ${CXX} --version; fi
-
 case "${BUILDER}" in
 check-generated-output)
     # `! foo` doesn't work properly with `set -e`, use `! foo || false` instead.
@@ -382,12 +391,16 @@ generic-ubsan)
 bootstrapping-build)
     clean
 
+    if which ccache; then
+        CCACHE="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
+    fi
+
     step "Generating CMake"
     ${CMAKE} \
           -S "${MONOREPO_ROOT}/llvm" \
           -B "${BUILD_DIR}" \
           -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
-          -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
+          ${CCACHE} \
           -DCMAKE_BUILD_TYPE=Release \
           -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
           -DLLVM_ENABLE_PROJECTS="clang;lldb" \

@ldionne ldionne changed the title [libc++] Fix local runs of the bootstrapping-build job [libc++] Make CC and CXX environment variables mandatory in run-buildbot Nov 8, 2025
The bootstrapping-build job defined in run-buildbot required the
CC and CXX environment variables to be defined even though run-buildbot
documents these environment variables as being optional.

It also required ccache, which may not be available for local builds.

This patch tweaks the script slightly to better deal with the absence
of these environment variables/tools.
@ldionne ldionne force-pushed the review/fix-run-buildbot-envvars branch from 09cc432 to 1129186 Compare November 8, 2025 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github:workflow libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants