[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 03:02:25 PDT 2023
mstorsjo created this revision.
mstorsjo added a reviewer: phosek.
Herald added a subscriber: arichardson.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.
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.
We simulate that scenario by making a copy of the existing sysroot
and remove libunwind/libcxx from it, and point to this with the
--sysroot option passed via CMAKE_*_FLAGS_INIT.
We need to set CMAKE_CXX_COMPILER_WORKS since CMake fails to
probe the compiler. We need to set CMAKE_CXX_COMPILER_TARGET,
since LLVM's heuristics fail when CMake hasn't been able to
probe the environment properly. (This is normal; one has to
set those options when setting up such a toolchain from scratch.)
This adds CI coverage for these build scenarios, which otherwise
seldom are tested by some build flow (but are essential when setting
up a cross compiler from scratch).
Repository:
rG LLVM Github Monorepo
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,45 @@
-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.
+ # Pass this sysroot to CMake via CMAKE_*_FLAGS_INIT to make sure it
+ # is used throughout all the early CMake probing stages.
+ 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_C_FLAGS_INIT="--sysroot=${BUILD_DIR}/sysroot" \
+ -DCMAKE_CXX_FLAGS_INIT="--sysroot=${BUILD_DIR}/sysroot" \
+ -DCMAKE_C_COMPILER_WORKS=TRUE \
+ -DCMAKE_CXX_COMPILER_WORKS=TRUE \
+ -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 flags from CMAKE_*_FLAGS/CMAKE_*_FLAGS_INIT
+ # don't even propagate into the tests at the moment.
+ ${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.522977.patch
Type: text/x-patch
Size: 3361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230517/62d4ba95/attachment.bin>
More information about the libcxx-commits
mailing list