Skip to content

Commit

Permalink
Disable thread-local usage on MinGW platforms, see issue #213.
Browse files Browse the repository at this point in the history
  • Loading branch information
saschazelzer committed Aug 14, 2017
1 parent 9466ca4 commit 2b1754b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ if(US_BUILD_TESTING)

set(GTEST_BOTH_LIBRARIES gtest gtest_main)

# This project also sets BUILD_SHARED_LIBS. We want to guarantee that GTest is always built as a
# This project also sets BUILD_SHARED_LIBS. We want to guarantee that GTest is always built as a
# static library even if CppMicroServices is a shared library.
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
add_subdirectory(third_party/googletest)
Expand Down Expand Up @@ -479,6 +479,19 @@ return 0;
}
" US_HAVE_THREAD_LOCAL)

if(MINGW)
#
# The MinGW winpthread implementation does not properly destruct
# non-POD thread-local objects, leading to segmentation faults on
# thread exit. See
#
# https://github.com/Alexpux/MINGW-packages/issues/2519
# https://sourceforge.net/p/mingw-w64/bugs/527/
#
set(US_HAVE_THREAD_LOCAL 0)
set(disabled_func "${disabled_func}MinGW winpthread: ")
endif()

if(NOT US_HAVE_THREAD_LOCAL AND US_ENABLE_THREADING_SUPPORT)
set(disabled_func "${disabled_func}thread_local support unavailable. Recursive service factory calls will not be detected. See also https://github.com/CppMicroServices/CppMicroServices/issues/213\n")
endif()
Expand Down

0 comments on commit 2b1754b

Please sign in to comment.