You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by gr...@apache.org on 2020/11/30 00:19:25 UTC

[kudu] 02/02: [thirdparty] Upgrade CMake to 3.19.1

This is an automated email from the ASF dual-hosted git repository.

granthenke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 0e2c28864c27727c9723db7f319a5d7ebcbeead7
Author: Grant Henke <gr...@apache.org>
AuthorDate: Thu Nov 19 13:59:44 2020 -0600

    [thirdparty] Upgrade CMake to 3.19.1
    
    CMake 3.19.1 has some improvements when building on macOS,
    especially with Xcode 12+.
    
    This patch also includes some fixes for macOS that would
    likely occur when using this new version of CMake and
    potentially occurred on older versions as well depending
    on the environment.
    
    Change-Id: I125448a3057d0c9da8c82f7e29683ef7844b0aa8
    Reviewed-on: http://gerrit.cloudera.org:8080/16785
    Tested-by: Grant Henke <gr...@apache.org>
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
---
 CMakeLists.txt                  |  5 +++++
 src/kudu/codegen/CMakeLists.txt | 11 +++--------
 src/kudu/util/env_posix.cc      |  5 +++++
 thirdparty/vars.sh              |  2 +-
 4 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a3b607..aeccb9a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,6 +24,11 @@ cmake_minimum_required(VERSION 3.11.2)
 
 project(Kudu)
 
+# Print out the CMAKE_OSX_SYSROOT to help debug Apple build issues.
+if (CMAKE_OSX_SYSROOT)
+  message(STATUS "Using CMAKE_OSX_SYSROOT: ${CMAKE_OSX_SYSROOT}")
+endif()
+
 # Prevent builds from the top-level source directory. This ensures that build
 # output is well isolated from the source tree.
 #
diff --git a/src/kudu/codegen/CMakeLists.txt b/src/kudu/codegen/CMakeLists.txt
index 5ce82ac..19ef2f5 100644
--- a/src/kudu/codegen/CMakeLists.txt
+++ b/src/kudu/codegen/CMakeLists.txt
@@ -69,7 +69,7 @@ if (APPLE)
   # Clang does not know about by default.
   set(PREFIXED_IR_INCLUDES
     ${PREFIXED_IR_INCLUDES}
-    -cxx-isystem "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1")
+    -cxx-isystem "/Library/Developer/CommandLineTools/usr/include/c++/v1")
 endif()
 
 # Get preprocessing definitions, which enable directives for glog and gtest.
@@ -90,19 +90,14 @@ set(IR_FLAGS
   ${PREFIXED_IR_INCLUDES})
 
 # /usr/include doesn't have the necessary headers on macOS 10.14 (Mojave) with
-# Xcode 10[1]. In this case the --sysroot has to be set to the output of "xcrun
+# Xcode 10[1]+. In this case the --sysroot has to be set to the output of "xcrun
 # --show-sdk-path" for the thirdparty clang-6.0 to work correctly.
 #
 # [1] https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes
 if (APPLE AND NOT EXISTS /usr/include/libc.h)
-  EXECUTE_PROCESS (COMMAND
-    xcrun --show-sdk-path
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-    OUTPUT_VARIABLE SDKPATH)
-
   set(IR_FLAGS
     ${IR_FLAGS}
-    --sysroot="${SDKPATH}")
+    --sysroot="${CMAKE_OSX_SYSROOT}")
 endif()
 
 # Provide clang with any explicitly defined system prefix path. If there isn't
diff --git a/src/kudu/util/env_posix.cc b/src/kudu/util/env_posix.cc
index 4b1078a..4a83314 100644
--- a/src/kudu/util/env_posix.cc
+++ b/src/kudu/util/env_posix.cc
@@ -248,6 +248,9 @@ int fallocate(int fd, int mode, off_t offset, off_t len) {
   return 0;
 }
 
+// Implementations for `preadv` and `pwritev` are available in the MacOSX11+ SDK.
+// We provide simulated implementations for older versions.
+#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED < 110000
 // Simulates Linux's preadv API on OS X.
 ssize_t preadv(int fd, const struct iovec* iovec, int count, off_t offset) {
   ssize_t total_read_bytes = 0;
@@ -285,6 +288,8 @@ ssize_t pwritev(int fd, const struct iovec* iovec, int count, off_t offset) {
 }
 #endif
 
+#endif
+
 void DoClose(int fd) {
   int err;
   RETRY_ON_EINTR(err, close(fd));
diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh
index 8233075..04fa883 100644
--- a/thirdparty/vars.sh
+++ b/thirdparty/vars.sh
@@ -60,7 +60,7 @@ PROTOBUF_SOURCE=$TP_SOURCE_DIR/$PROTOBUF_NAME
 
 # Note: CMake gets patched on SLES12SP0. When changing the CMake version, please check if
 # cmake-issue-15873-dont-use-select.patch needs to be updated.
-CMAKE_VERSION=3.16.4
+CMAKE_VERSION=3.19.1
 CMAKE_NAME=cmake-$CMAKE_VERSION
 CMAKE_SOURCE=$TP_SOURCE_DIR/$CMAKE_NAME