Skip to content

[CI] Use LLVM_ENABLE_RUNTIMES for runtimes builds on Linux #142694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

boomanaiden154
Copy link
Contributor

This patch switches us to using LLVM_ENABLE_RUNTIMES rather than using
separate runtimes builds for some reductions in CMake configuration time
and some simplification of the monolithic-linux.sh script.

Copy link
Contributor

@Endilll Endilll left a comment

Choose a reason for hiding this comment

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

Something feels wrong with this PR:

  1. There's a "full changes here" button on the Files Changed tab, which shows me a bunch of changes to libc++ tests adding #include <span>
  2. In the new version, I don't see LLVM_ENABLE_RUTIMES passed to cmake. Not even CMAKE_BUILD_TYPE and CMAKE_CXX_COMPILER.

What's going on?

@boomanaiden154
Copy link
Contributor Author

There's a "full changes here" button on the Files Changed tab, which shows me a bunch of changes to libc++ tests adding #include

I'm not sure how you're seeing this. Those changes are in #142693.

In the new version, I don't see LLVM_ENABLE_RUTIMES passed to cmake. Not even CMAKE_BUILD_TYPE and CMAKE_CXX_COMPILER.

We're just modifying the existing CMake invocation. That one has LLVM_ENABLE_RUNTIMES set to libcxx;libcxxabi;libunwind. #142695 and #142696 modify that though so we can start building libc and compiler-rt through the runtimes build given building them through LLVM_ENABLE_PROJECTS is going to be deprecated soon.

Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

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

CMake once with the runtimes enabled. Modify the test parameters each time.

Looks good to me.

@Endilll
Copy link
Contributor

Endilll commented Jun 4, 2025

I'm not sure how you're seeing this.

image
image

@Endilll
Copy link
Contributor

Endilll commented Jun 4, 2025

I just opened 9e3490b in my local git, and yes, all libc++ changes are there alongside changes to monolithic-linux.sh that we're interested in

Copy link
Contributor

@Endilll Endilll left a comment

Choose a reason for hiding this comment

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

We're just modifying the existing CMake invocation. That one has LLVM_ENABLE_RUNTIMES set to libcxx;libcxxabi;libunwind. #142695 and #142696 modify that though so we can start building libc and compiler-rt through the runtimes build given building them through LLVM_ENABLE_PROJECTS is going to be deprecated soon.

What I see is that you're reusing the same initial CMake config for everything, even though in order to test Clang against libc++ and its tests, we need to reconfigure CMake to use just-built Clang, by supplying -D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" and -D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++". Otherwise we're simply losing this additional coverage for Clang.

I don't see this addressed in two PRs you linked.

@cor3ntin
Copy link
Contributor

cor3ntin commented Jun 4, 2025

This is a merge commit, it might be worth rebasing / cherry picking on a clean branch

@cor3ntin cor3ntin added infrastructure Bugs about LLVM infrastructure libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. labels Jun 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 4, 2025

@llvm/pr-subscribers-libcxx

Author: Aiden Grossman (boomanaiden154)

Changes

This patch switches us to using LLVM_ENABLE_RUNTIMES rather than using
separate runtimes builds for some reductions in CMake configuration time
and some simplification of the monolithic-linux.sh script.


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

1 Files Affected:

  • (modified) .ci/monolithic-linux.sh (+10-36)
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index f5a31fa45a641..52a80958b4025 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -102,51 +102,25 @@ if [[ "${runtimes}" != "" ]]; then
     exit 1
   fi
 
-  echo "--- ninja install-clang"
-
-  ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
-
-  RUNTIMES_BUILD_DIR="${MONOREPO_ROOT}/build-runtimes"
-  INSTALL_DIR="${BUILD_DIR}/install"
-  mkdir -p ${RUNTIMES_BUILD_DIR}
-
   echo "--- cmake runtimes C++26"
 
-  rm -rf "${RUNTIMES_BUILD_DIR}"
-  cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
-      -D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
-      -D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
-      -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
-      -D LIBCXX_CXX_ABI=libcxxabi \
-      -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-      -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-      -D LIBCXX_TEST_PARAMS="std=c++26" \
-      -D LIBCXXABI_TEST_PARAMS="std=c++26" \
-      -D LLVM_LIT_ARGS="${lit_args}"
+  cmake \
+    -D LIBCXX_TEST_PARAMS="std=c++26" \
+    -D LIBCXXABI_TEST_PARAMS="std=c++26" \
+    "${BUILD_DIR}"
 
   echo "--- ninja runtimes C++26"
 
-  ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
+  ninja -C "${BUILD_DIR}" ${runtime_targets}
 
   echo "--- cmake runtimes clang modules"
 
-  # We don't need to do a clean build of runtimes, because LIBCXX_TEST_PARAMS
-  # and LIBCXXABI_TEST_PARAMS only affect lit configuration, which successfully
-  # propagates without a clean build. Other that those two variables, builds
-  # are supposed to be the same.
-
-  cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
-      -D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
-      -D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
-      -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
-      -D LIBCXX_CXX_ABI=libcxxabi \
-      -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-      -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-      -D LIBCXX_TEST_PARAMS="enable_modules=clang" \
-      -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
-      -D LLVM_LIT_ARGS="${lit_args}"
+  cmake \
+    -D LIBCXX_TEST_PARAMS="enable_modules=clang" \
+    -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
+    "${BUILD_DIR}"
 
   echo "--- ninja runtimes clang modules"
 
-  ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
+  ninja -C "${BUILD_DIR}" ${runtime_targets}
 fi

@boomanaiden154
Copy link
Contributor Author

What I see is that you're reusing the same initial CMake config for everything, even though in order to test Clang against libc++ and its tests, we need to reconfigure CMake to use just-built Clang, by supplying -D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" and -D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++". Otherwise we're simply losing this additional coverage for Clang.

We're using LLVM_ENABLE_RUNTIMES. It uses the just built clang to build the runtimes specified. We're just doing this in a single CMake invocation (which will spawn sub-CMake invocations) rather than in multiple CMake invocations.

@boomanaiden154 boomanaiden154 requested a review from Endilll June 5, 2025 06:51
Copy link
Contributor

@Endilll Endilll left a comment

Choose a reason for hiding this comment

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

We're using LLVM_ENABLE_RUNTIMES. It uses the just built clang to build the runtimes specified.

That explains it, thank you.
There's still an outstanding question of unrelated changes to libc++ tests that are included in this PR.

@boomanaiden154
Copy link
Contributor Author

There's still an outstanding question of unrelated changes to libc++ tests that are included in this PR.

I'm still not sure how they're ending up in here. I haven't seen this before with spr. This will definitely be fixed before I end up landing the patch and I'm guessing will be resolved when I change the branch target to main.

boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Jun 5, 2025
This patch switches us to using LLVM_ENABLE_RUNTIMES rather than using
separate runtimes builds for some reductions in CMake configuration time
and some simplification of the monolithic-linux.sh script.

Pull Request: llvm#142694
boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Jun 5, 2025
This patch switches us to using LLVM_ENABLE_RUNTIMES rather than using
separate runtimes builds for some reductions in CMake configuration time
and some simplification of the monolithic-linux.sh script.

Pull Request: llvm#142694
boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Jun 5, 2025
This patch switches us to using LLVM_ENABLE_RUNTIMES rather than using
separate runtimes builds for some reductions in CMake configuration time
and some simplification of the monolithic-linux.sh script.

Pull Request: llvm#142694
Created using spr 1.3.4

[skip ci]
Created using spr 1.3.4
Created using spr 1.3.4

[skip ci]
Created using spr 1.3.4
boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Jun 5, 2025
This patch switches us to using LLVM_ENABLE_RUNTIMES rather than using
separate runtimes builds for some reductions in CMake configuration time
and some simplification of the monolithic-linux.sh script.

Pull Request: llvm#142694
@boomanaiden154
Copy link
Contributor Author

Branch seems to be cleaned up now.

@boomanaiden154 boomanaiden154 requested a review from Endilll June 5, 2025 08:56
-D LIBCXX_TEST_PARAMS="std=c++26" \
-D LIBCXXABI_TEST_PARAMS="std=c++26" \
-D LLVM_LIT_ARGS="${lit_args}"
cmake \
Copy link
Member

Choose a reason for hiding this comment

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

I think I don't quite understand what this change does. You're basically just re-generating the CMake cache and re-running ninja every time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Rerunning CMake with the existing cache so we don't have to rerun all the checks just to change the test configuration. Then we run ninja which goes through the runtimes build. This is mainly to make it simpler to move compiler-rt and libc over to the runtimes build.

Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
@boomanaiden154 boomanaiden154 changed the base branch from users/boomanaiden154/main.ci-use-llvm_enable_runtimes-for-runtimes-builds-on-linux to main June 8, 2025 22:05
@boomanaiden154 boomanaiden154 merged commit b93e421 into main Jun 8, 2025
9 of 10 checks passed
@boomanaiden154 boomanaiden154 deleted the users/boomanaiden154/ci-use-llvm_enable_runtimes-for-runtimes-builds-on-linux branch June 8, 2025 22:06
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Jun 8, 2025
This patch switches us to using LLVM_ENABLE_RUNTIMES rather than using
separate runtimes builds for some reductions in CMake configuration time
and some simplification of the monolithic-linux.sh script.

Reviewers: DavidSpickett, cmtice, lnihlen, Endilll, tstellar

Reviewed By: Endilll, DavidSpickett

Pull Request: llvm/llvm-project#142694
rorth pushed a commit to rorth/llvm-project that referenced this pull request Jun 11, 2025
This patch switches us to using LLVM_ENABLE_RUNTIMES rather than using
separate runtimes builds for some reductions in CMake configuration time
and some simplification of the monolithic-linux.sh script.

Reviewers: DavidSpickett, cmtice, lnihlen, Endilll, tstellar

Reviewed By: Endilll, DavidSpickett

Pull Request: llvm#142694
DhruvSrivastavaX pushed a commit to DhruvSrivastavaX/lldb-for-aix that referenced this pull request Jun 12, 2025
This patch switches us to using LLVM_ENABLE_RUNTIMES rather than using
separate runtimes builds for some reductions in CMake configuration time
and some simplification of the monolithic-linux.sh script.

Reviewers: DavidSpickett, cmtice, lnihlen, Endilll, tstellar

Reviewed By: Endilll, DavidSpickett

Pull Request: llvm#142694
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
This patch switches us to using LLVM_ENABLE_RUNTIMES rather than using
separate runtimes builds for some reductions in CMake configuration time
and some simplification of the monolithic-linux.sh script.

Reviewers: DavidSpickett, cmtice, lnihlen, Endilll, tstellar

Reviewed By: Endilll, DavidSpickett

Pull Request: llvm#142694
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Bugs about LLVM infrastructure libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants