Index: include/__config =================================================================== --- include/__config +++ include/__config @@ -1225,7 +1225,8 @@ # endif #endif -#if __has_attribute(require_constant_initialization) +#if __has_attribute(require_constant_initialization) && \ + !(defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__MINGW32__)) # define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__)) #else # define _LIBCPP_SAFE_STATIC Index: lib/CMakeLists.txt =================================================================== --- lib/CMakeLists.txt +++ lib/CMakeLists.txt @@ -4,7 +4,13 @@ # FIXME: Don't use glob here file(GLOB LIBCXX_SOURCES ../src/*.cpp) if(WIN32) - file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp) + set(LIBCXX_WIN32_SOURCES + ../src/support/win32/locale_win32.cpp + ../src/support/win32/support.cpp + ) + if(LIBCXX_HAS_WIN32_THREAD_API) + list(APPEND LIBCXX_WIN32_SOURCES ../src/support/win32/thread_win32.cpp) + endif() list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES}) elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS") file(GLOB LIBCXX_SOLARIS_SOURCES ../src/support/solaris/*.cpp)