You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2018/02/15 21:51:52 UTC

kudu git commit: [CMakeLists] un-break build with gcc 4.9.2

Repository: kudu
Updated Branches:
  refs/heads/master 0396cca5b -> 0eef8e077


[CMakeLists] un-break build with gcc 4.9.2

This is a quick fix to un-break build of Kudu as a part of Impala's
build with gcc 4.9.2.

For some reason, the compiler is happy with the -fsized-deallocation
option while compiling the small test, but then the compilation fails
with errors like below:

  g++: error: unrecognized command line option ‘-fsized-deallocation’
  g++: error: unrecognized command line option ‘-fno-sized-deallocation’

Change-Id: Ie02ae6229023101cca9f3a39292a648d20349a88
Reviewed-on: http://gerrit.cloudera.org:8080/9333
Reviewed-by: Grant Henke <gr...@gmail.com>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/0eef8e07
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/0eef8e07
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/0eef8e07

Branch: refs/heads/master
Commit: 0eef8e077fd21e871dabcb24aa1f9ce7e4f1cadf
Parents: 0396cca
Author: Alexey Serbin <as...@cloudera.com>
Authored: Wed Feb 14 18:53:21 2018 -0800
Committer: Alexey Serbin <as...@cloudera.com>
Committed: Thu Feb 15 21:39:19 2018 +0000

----------------------------------------------------------------------
 CMakeLists.txt | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/0eef8e07/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cabcd1e..c906cc3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1084,17 +1084,33 @@ ADD_THIRDPARTY_LIB(boost_date_time
 # compiler options since we only do this when tcmalloc was
 # found and enabled.
 ############################################################
-get_filename_component(SIZED_DEALLOCATION_TEST_TCMALLOC_LIBDIR
-  ${TCMALLOC_STATIC_LIB} DIRECTORY)
-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${SIZED_DEALLOCATION_TEST_TCMALLOC_LIBDIR} -ltcmalloc -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)
+
+# On OS X 10.12 (El Capitan), sized-deallocation symbols are missing
+# in the libc++ library for some reason.
+if (APPLE)
+  get_filename_component(SIZED_DEALLOCATION_TEST_TCMALLOC_LIBDIR
+    ${TCMALLOC_STATIC_LIB} DIRECTORY)
+  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${SIZED_DEALLOCATION_TEST_TCMALLOC_LIBDIR} -ltcmalloc -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)
+  endif()
+else()
+  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")))
+    set(COMPILER_SUPPORTS_SIZED_DEALLOCATION TRUE)
+  endif()
+endif()
+
+if(COMPILER_SUPPORTS_SIZED_DEALLOCATION)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsized-deallocation")
   message("sized-deallocation is ENABLED")
 else()