diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/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: diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot --- a/libcxx/utils/ci/run-buildbot +++ b/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" \