Skip to content

Commit 9c438ab

Browse files
committed
HDFS-14033. [libhdfs++] Disable libhdfs++ build on systems that do not support thread_local. Contributed by Anatoli Shein.
1 parent fac9f91 commit 9c438ab

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,27 @@ endif()
138138

139139
add_subdirectory(main/native/libhdfs)
140140
add_subdirectory(main/native/libhdfs-tests)
141-
add_subdirectory(main/native/libhdfspp)
141+
142+
# Temporary fix to disable Libhdfs++ build on older systems that do not support thread_local
143+
include(CheckCXXSourceCompiles)
144+
unset (THREAD_LOCAL_SUPPORTED CACHE)
145+
set (CMAKE_REQUIRED_DEFINITIONS "-std=c++11")
146+
set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
147+
check_cxx_source_compiles(
148+
"#include <thread>
149+
int main(void) {
150+
thread_local int s;
151+
return 0;
152+
}"
153+
THREAD_LOCAL_SUPPORTED)
154+
if (THREAD_LOCAL_SUPPORTED)
155+
add_subdirectory(main/native/libhdfspp)
156+
else()
157+
message(WARNING
158+
"WARNING: Libhdfs++ library was not built because the required feature thread_local storage \
159+
is not supported by your compiler. Known compilers that support this feature: GCC 4.8+, Visual Studio 2015+, \
160+
Clang (community version 3.3+), Clang (version for Xcode 8+ and iOS 9+).")
161+
endif (THREAD_LOCAL_SUPPORTED)
142162

143163
if(REQUIRE_LIBWEBHDFS)
144164
add_subdirectory(contrib/libwebhdfs)

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ check_cxx_source_compiles(
6363
if (NOT THREAD_LOCAL_SUPPORTED)
6464
message(FATAL_ERROR
6565
"FATAL ERROR: The required feature thread_local storage is not supported by your compiler. \
66-
Known compilers that support this feature: GCC, Visual Studio, Clang (community version), \
67-
Clang (version for iOS 9 and later).")
66+
Known compilers that support this feature: GCC 4.8+, Visual Studio 2015+, Clang (community \
67+
version 3.3+), Clang (version for Xcode 8+ and iOS 9+).")
6868
endif (NOT THREAD_LOCAL_SUPPORTED)
6969

7070
# Check if PROTOC library was compiled with the compatible compiler by trying

0 commit comments

Comments
 (0)