Skip to content

Commit

Permalink
[libcxx] [ci] Add CI configurations for MinGW
Browse files Browse the repository at this point in the history
Mention support for MinGW in the docs. Rename the existing windows
CI jobs to Clang-cl, as both Clang-cl and MinGW are equally much
"Windows", just different toolchain environments.

Add an XFAIL for a recently added test that fails in the MinGW DLL
configuration (with an explanation of what's causing the failure).

Differential Revision: https://reviews.llvm.org/D112215
  • Loading branch information
mstorsjo committed Nov 17, 2021
1 parent 663693f commit f5ca3ac
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 7 deletions.
20 changes: 20 additions & 0 deletions libcxx/cmake/caches/MinGW.cmake
@@ -0,0 +1,20 @@
set(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY OFF CACHE BOOL "")
set(LIBCXX_HAS_WIN32_THREAD_API ON CACHE BOOL "")

set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")

set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")

set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")

set(LIBCXX_TARGET_INFO "libcxx.test.target_info.MingwLocalTI" CACHE STRING "")

# Without these flags, 'long double' (which is 80 bit on x86 mingw, but
# 64 bit in MSVC) isn't handled correctly in printf.
set(CMAKE_C_FLAGS "-D__USE_MINGW_ANSI_STDIO=1" CACHE STRING "")
set(CMAKE_CXX_FLAGS "-D__USE_MINGW_ANSI_STDIO=1" CACHE STRING "")
set(LIBCXX_TEST_COMPILER_FLAGS "-D__USE_MINGW_ANSI_STDIO=1" CACHE STRING "")
2 changes: 1 addition & 1 deletion libcxx/docs/index.rst
Expand Up @@ -117,7 +117,7 @@ Target platform Target architecture Notes
macOS 10.9+ i386, x86_64, arm64 Building the shared library itself requires targetting macOS 10.11+
FreeBSD 10+ i386, x86_64, arm
Linux i386, x86_64, arm, arm64
Windows x86_64
Windows x86_64 Both MSVC and MinGW style environments
AIX powerpc, powerpc64
=============== ========================= ============================

Expand Down
Expand Up @@ -10,6 +10,13 @@

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20

// This test fails on MinGW DLL configurations, due to
// __exclude_from_explicit_instantiation__ not behaving as it should in
// combination with dllimport (https://llvm.org/PR41018), in combination
// with running tests in c++2b mode while building the library in c++20 mode.
// (If the library was built in c++2b mode, this test would succeed.)
// XFAIL: target={{.+}}-windows-gnu && windows-dll

// template <class charT, class traits = char_traits<charT> >
// class basic_ostream;

Expand Down
32 changes: 28 additions & 4 deletions libcxx/utils/ci/buildkite-pipeline.yml
Expand Up @@ -506,8 +506,8 @@ steps:
timeout_in_minutes: 120

# Tests on non-Unix platforms
- label: "Windows (DLL)"
command: "bash libcxx/utils/ci/run-buildbot windows-dll"
- label: "Clang-cl (DLL)"
command: "bash libcxx/utils/ci/run-buildbot clang-cl-dll"
artifact_paths:
- "**/test-results.xml"
agents:
Expand All @@ -518,8 +518,32 @@ steps:
limit: 2
timeout_in_minutes: 120

- label: "Windows (Static)"
command: "bash libcxx/utils/ci/run-buildbot windows-static"
- label: "Clang-cl (Static)"
command: "bash libcxx/utils/ci/run-buildbot clang-cl-static"
artifact_paths:
- "**/test-results.xml"
agents:
queue: "windows"
retry:
automatic:
- exit_status: -1 # Agent was lost
limit: 2
timeout_in_minutes: 120

- label: "MinGW (DLL)"
command: "bash libcxx/utils/ci/run-buildbot mingw-dll"
artifact_paths:
- "**/test-results.xml"
agents:
queue: "windows"
retry:
automatic:
- exit_status: -1 # Agent was lost
limit: 2
timeout_in_minutes: 120

- label: "MinGW (Static)"
command: "bash libcxx/utils/ci/run-buildbot mingw-static"
artifact_paths:
- "**/test-results.xml"
agents:
Expand Down
29 changes: 27 additions & 2 deletions libcxx/utils/ci/run-buildbot
Expand Up @@ -597,7 +597,7 @@ armv7-noexceptions)
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
check-runtimes
;;
windows-dll)
clang-cl-dll)
clean
# TODO: Currently, building with the experimental library breaks running
# tests (the test linking look for the c++experimental library with the
Expand All @@ -609,12 +609,37 @@ windows-dll)
echo "+++ Running the libc++ tests"
${NINJA} -vC "${BUILD_DIR}" check-cxx
;;
windows-static)
clang-cl-static)
clean
generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF
echo "+++ Running the libc++ tests"
${NINJA} -vC "${BUILD_DIR}" check-cxx
;;
mingw-dll)
clean
# Explicitly specify the compiler with a triple prefix. The CI
# environment has got two installations of Clang; the default one
# defaults to MSVC mode, while there's an installation of llvm-mingw
# further back in PATH. By calling the compiler with an explicit
# triple prefix, we use the one that is bundled with a mingw sysroot.
generate-cmake \
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
echo "+++ Running the libc++ tests"
${NINJA} -vC "${BUILD_DIR}" check-cxx
;;
mingw-static)
clean
generate-cmake \
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" \
-DLIBCXX_ENABLE_SHARED=OFF \
-DLIBUNWIND_ENABLE_SHARED=OFF
echo "+++ Running the libc++ tests"
${NINJA} -vC "${BUILD_DIR}" check-cxx
;;
aix)
export CC=ibm-clang
export CXX=ibm-clang++_r
Expand Down

0 comments on commit f5ca3ac

Please sign in to comment.