Skip to content

Commit 4935ea0

Browse files
authored
build(thirdparty): fix thirdparties build failure on macOS caused by removal of compatibility with CMake versions < 3.5 (apache#2294)
Resolve apache#2295. Since compatibility with CMake versions below 3.5 has been removed on macOS, we need to update the minimum required CMake version for affected third-party dependencies to 3.5 in order to fix the build failures.
1 parent 05fe09c commit 4935ea0

File tree

2 files changed

+105
-1
lines changed

2 files changed

+105
-1
lines changed

thirdparty/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ ExternalProject_Add(thrift
188188
URL_MD5 88d667a8ae870d5adeca8cb7d6795442
189189
PATCH_COMMAND patch -p1 < ${TP_DIR}/fix_thrift_build_and_link_errors.patch
190190
CMAKE_ARGS -DCMAKE_BUILD_TYPE=release
191+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
191192
-DWITH_JAVA=OFF
192193
-DWITH_PYTHON=OFF
193194
-DWITH_C_GLIB=OFF
@@ -247,6 +248,7 @@ ExternalProject_Add(libevent
247248
URL_MD5 80f8652e4b08d2ec86a5f5eb46b74510
248249
PATCH_COMMAND patch -p1 < ${TP_DIR}/fix_libevent_for_macos.patch
249250
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${TP_OUTPUT}
251+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
250252
-DEVENT__DISABLE_DEBUG_MODE=On
251253
-DEVENT__DISABLE_BENCHMARK=On
252254
-DEVENT__DISABLE_TESTS=On
@@ -374,6 +376,7 @@ ExternalProject_Add(jemalloc
374376
set(SNAPPY_OPTIONS
375377
-DCMAKE_INSTALL_PREFIX=${TP_OUTPUT}
376378
-DCMAKE_INSTALL_LIBDIR=lib
379+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
377380
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
378381
-DCMAKE_BUILD_TYPE=Release
379382
-DBUILD_SHARED_LIBS=OFF
@@ -408,6 +411,7 @@ ExternalProject_Add(zstd
408411
CONFIGURE_COMMAND cmake build/cmake
409412
-DCMAKE_INSTALL_PREFIX=${TP_OUTPUT}
410413
-DCMAKE_INSTALL_LIBDIR=lib
414+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
411415
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
412416
-DCMAKE_BUILD_TYPE=Release
413417
-DZSTD_BUILD_PROGRAMS=OFF
@@ -430,6 +434,7 @@ ExternalProject_Add(lz4
430434
CONFIGURE_COMMAND cmake build/cmake
431435
-DCMAKE_INSTALL_PREFIX=${TP_OUTPUT}
432436
-DCMAKE_INSTALL_LIBDIR=lib
437+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
433438
-DLZ4_POSITION_INDEPENDENT_LIB=ON
434439
-DCMAKE_BUILD_TYPE=Release
435440
-DLZ4_BUILD_CLI=OFF

thirdparty/fix_hdfs_native_client.patch

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,103 @@ index 24ec297aa27b..e77c38435bba 100644
2929
+endif (REQUIRE_LIBHDFSPP)
3030

3131
if(REQUIRE_LIBWEBHDFS)
32-
add_subdirectory(contrib/libwebhdfs)
32+
add_subdirectory(contrib/libwebhdfs)
33+
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/pom.xml b/hadoop-hdfs-project/hadoop-hdfs-native-client/pom.xml
34+
index 04cf060..a4fc0e3 100644
35+
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/pom.xml
36+
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/pom.xml
37+
@@ -147,7 +147,7 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
38+
<mkdir dir="${project.build.directory}/native"/>
39+
<exec executable="cmake" dir="${project.build.directory}/native"
40+
failonerror="true">
41+
- <arg line="${basedir}/src/ -DGENERATED_JAVAH=${project.build.directory}/native/javah -DJVM_ARCH_DATA_MODEL=${sun.arch.data.model} -DHADOOP_BUILD=1 -DREQUIRE_FUSE=${require.fuse} -DREQUIRE_VALGRIND=${require.valgrind} -A '${env.PLATFORM}'"/>
42+
+ <arg line="${basedir}/src/ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DGENERATED_JAVAH=${project.build.directory}/native/javah -DJVM_ARCH_DATA_MODEL=${sun.arch.data.model} -DHADOOP_BUILD=1 -DREQUIRE_FUSE=${require.fuse} -DREQUIRE_VALGRIND=${require.valgrind} -A '${env.PLATFORM}'"/>
43+
<arg line="${native_cmake_args}"/>
44+
</exec>
45+
<exec executable="msbuild" dir="${project.build.directory}/native"
46+
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt
47+
index 24ec297..e158d7b 100644
48+
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt
49+
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt
50+
@@ -16,7 +16,8 @@
51+
# limitations under the License.
52+
#
53+
54+
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
55+
+cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
56+
+project(hadoop-hdfs-native-client)
57+
58+
enable_testing()
59+
60+
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/CMakeLists.txt
61+
index c1ba3ad..44b18e6 100644
62+
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/CMakeLists.txt
63+
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/CMakeLists.txt
64+
@@ -16,8 +16,6 @@
65+
# limitations under the License.
66+
#
67+
68+
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
69+
-
70+
set(CMAKE_SKIP_RPATH TRUE)
71+
72+
# Flatten a list into a string.
73+
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-examples/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-examples/CMakeLists.txt
74+
index 1d33639..b950745 100644
75+
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-examples/CMakeLists.txt
76+
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-examples/CMakeLists.txt
77+
@@ -16,8 +16,6 @@
78+
# limitations under the License.
79+
#
80+
81+
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
82+
-
83+
include_directories(
84+
${CMAKE_CURRENT_SOURCE_DIR}/../libhdfs/include
85+
${GENERATED_JAVAH}
86+
@@ -31,4 +29,4 @@ add_executable(hdfs_read libhdfs_read.c)
87+
target_link_libraries(hdfs_read hdfs)
88+
89+
add_executable(hdfs_write libhdfs_write.c)
90+
-target_link_libraries(hdfs_write hdfs)
91+
\ No newline at end of file
92+
+target_link_libraries(hdfs_write hdfs)
93+
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/CMakeLists.txt
94+
index f16cc9e..01a671f 100644
95+
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/CMakeLists.txt
96+
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/CMakeLists.txt
97+
@@ -16,8 +16,6 @@
98+
# limitations under the License.
99+
#
100+
101+
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
102+
-
103+
include_directories(
104+
${CMAKE_CURRENT_SOURCE_DIR}/../libhdfs/include
105+
${GENERATED_JAVAH}
106+
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/CMakeLists.txt
107+
index a7fb311..b1e6f4e 100644
108+
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/CMakeLists.txt
109+
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/CMakeLists.txt
110+
@@ -16,8 +16,6 @@
111+
# limitations under the License.
112+
#
113+
114+
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
115+
-
116+
add_definitions(-DLIBHDFS_DLL_EXPORT)
117+
118+
include_directories(
119+
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt
120+
index f4dd492..0e9eee3 100644
121+
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt
122+
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt
123+
@@ -26,8 +26,6 @@
124+
125+
project (libhdfspp)
126+
127+
-cmake_minimum_required(VERSION 2.8)
128+
-
129+
enable_testing()
130+
include (CTest)
131+

0 commit comments

Comments
 (0)