未验证 提交 13924ac7 编写于 作者: M Michal Strehovský 提交者: GitHub

Fix HAVE_PTHREAD_CONDATTR_SETCLOCK detection on Android (#62978)

Android puts pthread stuff into libc. Because this wasn't detected, we are using some iOS fallbacks in System.Native. I'm propagating how pthreads are detected in the CoreCLR PAL (that was fixed up for Android in the CoreCLR PAL a couple years ago).

Failure to properly detect it here was causing build breaks in CoreCLR on Android (that's how I found this).
上级 9ddd58a5
......@@ -61,6 +61,9 @@ endif()
# which are not distinguished from the test failing. So no error for that one.
# For clang-5.0 avoid errors like "unused variable 'err' [-Werror,-Wunused-variable]".
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror -Wno-error=unused-value -Wno-error=unused-variable")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error=builtin-requires-header")
endif()
# Apple platforms like macOS/iOS allow targeting older operating system versions with a single SDK,
# the mere presence of a symbol in the SDK doesn't tell us whether the deployment target really supports it.
......@@ -675,7 +678,16 @@ check_symbol_exists(
time.h
HAVE_CLOCK_GETTIME_NSEC_NP)
check_library_exists(pthread pthread_condattr_setclock "" HAVE_PTHREAD_CONDATTR_SETCLOCK)
check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD)
check_library_exists(c pthread_create "" HAVE_PTHREAD_IN_LIBC)
if (HAVE_LIBPTHREAD)
set(PTHREAD_LIBRARY pthread)
elseif (HAVE_PTHREAD_IN_LIBC)
set(PTHREAD_LIBRARY c)
endif()
check_library_exists(${PTHREAD_LIBRARY} pthread_condattr_setclock "" HAVE_PTHREAD_CONDATTR_SETCLOCK)
check_symbol_exists(
futimes
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册