Browse Source

HADOOP-16739. Fix native build failure of hadoop-pipes on CentOS 8.

Masatake Iwasaki 5 years ago
parent
commit
df7cc1edb0
1 changed files with 22 additions and 0 deletions
  1. 22 0
      hadoop-tools/hadoop-pipes/src/CMakeLists.txt

+ 22 - 0
hadoop-tools/hadoop-pipes/src/CMakeLists.txt

@@ -22,6 +22,25 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../../hadoop-common-project
 include(HadoopCommon)
 
 find_package(OpenSSL REQUIRED)
+find_package(PkgConfig QUIET)
+pkg_check_modules(LIBTIRPC libtirpc)
+
+find_path(RPC_INCLUDE_DIRS NAMES rpc/rpc.h)
+
+if (NOT RPC_INCLUDE_DIRS)
+    find_path(TIRPC_INCLUDE_DIRS
+        NAMES netconfig.h
+        PATH_SUFFIXES tirpc
+        HINTS ${LIBTIRPC_INCLUDE_DIRS}
+    )
+
+    find_library(TIRPC_LIBRARIES
+        NAMES tirpc
+        HINTS ${LIBTIRPC_LIBRARY_DIRS}
+    )
+
+    include_directories(${TIRPC_INCLUDE_DIRS})
+endif()
 
 include_directories(
     main/native/utils/api
@@ -51,6 +70,9 @@ add_library(hadooputils STATIC
     main/native/utils/impl/StringUtils.cc
     main/native/utils/impl/SerialUtils.cc
 )
+if (NOT RPC_INCLUDE_DIRS AND LIBTIRPC_FOUND)
+    target_link_libraries(hadooputils tirpc)
+endif()
 
 add_library(hadooppipes STATIC
     main/native/pipes/impl/HadoopPipes.cc