You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2018/02/06 08:08:58 UTC
[7/7] kudu git commit: [thirdparty] fix sized-deallocation issue on
OS X 10.11
[thirdparty] fix sized-deallocation issue on OS X 10.11
Fixed the issue of building gperftools 2.6.3 on OS X 10.11. Also,
updated the top-level CMakeLists.txt to enable or disable the sized
deallocation feature for Kudu binaries accordingly.
Change-Id: I12632df70137bf5aed8b44d613b08856a925d840
Reviewed-on: http://gerrit.cloudera.org:8080/9159
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/c1b9f108
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/c1b9f108
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/c1b9f108
Branch: refs/heads/master
Commit: c1b9f1088f830235f9d4e6830f59b1a200a65ab6
Parents: 6e5b157
Author: Alexey Serbin <as...@cloudera.com>
Authored: Mon Jan 29 18:56:35 2018 -0800
Committer: Todd Lipcon <to...@apache.org>
Committed: Tue Feb 6 08:01:09 2018 +0000
----------------------------------------------------------------------
CMakeLists.txt | 17 +++++----
thirdparty/download-thirdparty.sh | 3 +-
.../gperftools-sized-alloc-build-fix.patch | 36 ++++++++++++++++++++
3 files changed, 49 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/c1b9f108/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e60170a..9e0ca1e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1084,14 +1084,19 @@ ADD_THIRDPARTY_LIB(boost_date_time
# compiler options since we only do this when tcmalloc was
# found and enabled.
############################################################
-if (KUDU_TCMALLOC_AVAILABLE AND
- (("${COMPILER_FAMILY}" STREQUAL "clang" AND
- "${COMPILER_VERSION}" VERSION_GREATER "3.7") OR
- ("${COMPILER_FAMILY}" STREQUAL "gcc" AND
- "${COMPILER_VERSION}" VERSION_GREATER "5.0")))
+execute_process(
+ COMMAND printf
+ "#include <new>\nint main(){(::operator delete)(0,256);return 0;}\n"
+ COMMAND ${CMAKE_CXX_COMPILER}
+ -x c++ -fsized-deallocation -O0 -fno-builtin
+ -l:${TCMALLOC_SHARED_LIB} -o /dev/null -
+ RESULT_VARIABLE SIZED_DEALLOCATION_TEST_RESULT OUTPUT_QUIET ERROR_QUIET)
+if (${SIZED_DEALLOCATION_TEST_RESULT} EQUAL 0)
set(COMPILER_SUPPORTS_SIZED_DEALLOCATION TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsized-deallocation")
- message("Enabling sized-deallocation")
+ message("sized-deallocation is ENABLED")
+else()
+ message("sized-deallocation is DISABLED")
endif()
############################################################
http://git-wip-us.apache.org/repos/asf/kudu/blob/c1b9f108/thirdparty/download-thirdparty.sh
----------------------------------------------------------------------
diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh
index d699429..3bff35b 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -124,13 +124,14 @@ if [ ! -d $GFLAGS_SOURCE ]; then
fetch_and_expand gflags-${GFLAGS_VERSION}.tar.gz
fi
-GPERFTOOLS_PATCHLEVEL=1
+GPERFTOOLS_PATCHLEVEL=2
delete_if_wrong_patchlevel $GPERFTOOLS_SOURCE $GPERFTOOLS_PATCHLEVEL
if [ ! -d $GPERFTOOLS_SOURCE ]; then
fetch_and_expand gperftools-${GPERFTOOLS_VERSION}.tar.gz
pushd $GPERFTOOLS_SOURCE
patch -p1 < $TP_DIR/patches/gperftools-Replace-namespace-base-with-namespace-tcmalloc.patch
+ patch -p1 < $TP_DIR/patches/gperftools-sized-alloc-build-fix.patch
touch patchlevel-$GPERFTOOLS_PATCHLEVEL
autoreconf -fvi
popd
http://git-wip-us.apache.org/repos/asf/kudu/blob/c1b9f108/thirdparty/patches/gperftools-sized-alloc-build-fix.patch
----------------------------------------------------------------------
diff --git a/thirdparty/patches/gperftools-sized-alloc-build-fix.patch b/thirdparty/patches/gperftools-sized-alloc-build-fix.patch
new file mode 100644
index 0000000..2566070
--- /dev/null
+++ b/thirdparty/patches/gperftools-sized-alloc-build-fix.patch
@@ -0,0 +1,36 @@
+--- ./configure.ac.orig 2017-12-09 09:43:20.000000000 -0800
++++ ./configure.ac 2018-01-29 17:31:48.000000000 -0800
+@@ -370,8 +370,8 @@
+ [perftools_cv_sized_deallocation_result],
+ [AC_LANG_PUSH(C++)
+ OLD_CXXFLAGS="$CXXFLAGS"
+- CXXFLAGS="$CXXFLAGS -fsized-deallocation"
+- AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
++ CXXFLAGS="$CXXFLAGS -fsized-deallocation -O0 -fno-builtin"
++ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[#include <new>]],
+ [[(::operator delete)(0, 256)]])],
+ perftools_cv_sized_deallocation_result=yes,
+@@ -385,18 +385,21 @@
+ AC_CACHE_CHECK([if C++ compiler supports std::align_val_t without options],
+ [perftools_cv_have_align_val_t],
+ [AC_LANG_PUSH(C++)
++ OLD_CXXFLAGS="$CXXFLAGS"
++ CXXFLAGS="$CXXFLAGS -O0 -fno-builtin"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[#include <new>]],
+ [[(::operator delete)((::operator new)(256, std::align_val_t(16)), std::align_val_t(16))]])],
+ perftools_cv_have_align_val_t=yes,
+ perftools_cv_have_align_val_t=no)
++ CXXFLAGS="$OLD_CXXFLAGS"
+ AC_LANG_POP(C++)])
+
+ AC_CACHE_CHECK([if C++ compiler supports -faligned-new],
+ [perftools_cv_have_f_aligned_new],
+ [AC_LANG_PUSH(C++)
+ OLD_CXXFLAGS="$CXXFLAGS"
+- CXXFLAGS="$CXXFLAGS -faligned-new"
++ CXXFLAGS="$CXXFLAGS -faligned-new -O0 -fno-builtin"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[#include <new>]],
+ [[(::operator delete)((::operator new)(256, std::align_val_t(16)), std::align_val_t(16))]])],