[libcxx-commits] [PATCH] D150766: [libcxx] [ci] Add a test configuration with an incomplete sysroot

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 17 12:29:05 PDT 2023


mstorsjo updated this revision to Diff 523136.
mstorsjo added a comment.

Use `CMAKE_SYSROOT` instead of `CMAKE_*_FLAGS_INIT`, set `CMAKE_C_COMPILER_TARGET` for consistency.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150766/new/

https://reviews.llvm.org/D150766

Files:
  libcxx/utils/ci/buildkite-pipeline.yml
  libcxx/utils/ci/run-buildbot


Index: libcxx/utils/ci/run-buildbot
===================================================================
--- libcxx/utils/ci/run-buildbot
+++ libcxx/utils/ci/run-buildbot
@@ -645,6 +645,44 @@
           -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
     check-runtimes
 ;;
+mingw-incomplete-sysroot)
+    clean
+    # When bringing up a new cross compiler from scratch, we build
+    # libunwind/libcxx in a setup where the toolchain is incomplete and
+    # unable to perform the normal linker checks; this requires a few
+    # special cases in the CMake files.
+    #
+    # The CI environment uses prebuilt complete toolchains, but make a
+    # copy of a sysroot into the build dir, and remove libunwind/libcxx
+    # to simulate the real case of bringing up a new toolchain.
+    mkdir -p "${BUILD_DIR}/sysroot"
+    TOOLCHAIN="$(dirname $(command -v x86_64-w64-mingw32-clang))/.."
+    cp -a "${TOOLCHAIN}/x86_64-w64-mingw32/lib" "${BUILD_DIR}/sysroot"
+    cp -a "${TOOLCHAIN}/include" "${BUILD_DIR}/sysroot"
+    rm -rf "${BUILD_DIR}"/sysroot/lib/lib{c++,unwind}*
+    rm -rf "${BUILD_DIR}"/sysroot/include/c++
+    # Building in an incomplete setup requires setting CMAKE_*_COMPILER_WORKS,
+    # as CMake fails to probe the compiler. This case also requires
+    # setting CMAKE_CXX_COMPILER_TARGET, as LLVM's heuristics for setting
+    # the triple fails when CMake hasn't been able to probe the environment.
+    # (This is what one has to do when building the initial libunwind/libcxx
+    # for a new toolchain.)
+    generate-cmake \
+          -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
+          -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
+          -DCMAKE_SYSROOT="${BUILD_DIR}/sysroot" \
+          -DCMAKE_C_COMPILER_WORKS=TRUE \
+          -DCMAKE_CXX_COMPILER_WORKS=TRUE \
+          -DCMAKE_C_COMPILER_TARGET=x86_64-w64-windows-gnu \
+          -DCMAKE_CXX_COMPILER_TARGET=x86_64-w64-windows-gnu \
+          -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
+    # Only test that building succeeds; there's no extra value in running the
+    # tests here, as it would be equivalent to the mingw-dll config above.
+    # Additionally, the sysroot flag from CMAKE_SYSROOT doesn't end up
+    # propagated into the tests at the moment (neither do flags set via
+    # CMAKE_*_FLAGS).
+    ${NINJA} -vC "${BUILD_DIR}"
+;;
 aix)
     clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AIX.cmake" \
Index: libcxx/utils/ci/buildkite-pipeline.yml
===================================================================
--- libcxx/utils/ci/buildkite-pipeline.yml
+++ libcxx/utils/ci/buildkite-pipeline.yml
@@ -767,6 +767,19 @@
             limit: 2
       timeout_in_minutes: 120
 
+    - label: "MinGW (Incomplete Sysroot)"
+      command: "bash libcxx/utils/ci/run-buildbot mingw-incomplete-sysroot"
+      artifact_paths:
+        - "**/test-results.xml"
+        - "**/*.abilist"
+      agents:
+        queue: "windows"
+      retry:
+        automatic:
+          - exit_status: -1  # Agent was lost
+            limit: 2
+      timeout_in_minutes: 120
+
     - label: "MinGW (DLL, i686)"
       command: "bash libcxx/utils/ci/run-buildbot mingw-dll-i686"
       artifact_paths:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150766.523136.patch
Type: text/x-patch
Size: 3237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230517/1658b78f/attachment.bin>


More information about the libcxx-commits mailing list