[libcxx-commits] [libcxx] f5ca3ac - [libcxx] [ci] Add CI configurations for MinGW

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 17 00:02:22 PST 2021


Author: Martin Storsjö
Date: 2021-11-17T10:00:50+02:00
New Revision: f5ca3ac748af2c88736212d7dbc105d99ac721c1

URL: https://github.com/llvm/llvm-project/commit/f5ca3ac748af2c88736212d7dbc105d99ac721c1
DIFF: https://github.com/llvm/llvm-project/commit/f5ca3ac748af2c88736212d7dbc105d99ac721c1.diff

LOG: [libcxx] [ci] Add CI configurations for MinGW

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

Added: 
    libcxx/cmake/caches/MinGW.cmake

Modified: 
    libcxx/docs/index.rst
    libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp
    libcxx/utils/ci/buildkite-pipeline.yml
    libcxx/utils/ci/run-buildbot

Removed: 
    


################################################################################
diff  --git a/libcxx/cmake/caches/MinGW.cmake b/libcxx/cmake/caches/MinGW.cmake
new file mode 100644
index 0000000000000..458eb012ad154
--- /dev/null
+++ b/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 "")

diff  --git a/libcxx/docs/index.rst b/libcxx/docs/index.rst
index a150232e00b1d..6ed811fee1a82 100644
--- a/libcxx/docs/index.rst
+++ b/libcxx/docs/index.rst
@@ -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
 =============== ========================= ============================
 

diff  --git a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp
index 00d29fea50694..392e50d7f3f97 100644
--- a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp
@@ -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;
 

diff  --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index ee00db2b22f4c..96e2cb37cff79 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -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:
@@ -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:

diff  --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index e1b1a48dea069..1e35728b82be5 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -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
@@ -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


        


More information about the libcxx-commits mailing list