kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [2/8] incubator-kudu git commit: cmake: disable new gcc 5 ABI
Date Wed, 06 Jan 2016 23:46:14 GMT
cmake: disable new gcc 5 ABI

Code generation is broken when Kudu is built with gcc 5 on a distro where the
new ABI (new std::list and std::string) is on by default, such as my
machine's Ubuntu 15.10. That's because the precompiled code is built with
clang which doesn't (yet) support abi tags, and due to its dependency on glog,
it winds up with an undefined symbol that cannot be resolved at runtime.

Until clang supports abi tags [1], we must force the use of the old ABI in
Kudu and in any library code that interacts with Kudu.

Besides codegen, the new ABI also raised issues with slice comparison in
diskrowset-test and mt-diskrowset-test. These will also need to be addressed
if the new ABI is to be used in the future.

1. https://llvm.org/bugs/show_bug.cgi?id=23529

Change-Id: If5f4e0d3cd3285a54b185f13daed7463cb85505b
Reviewed-on: http://gerrit.cloudera.org:8080/1683
Tested-by: Dan Burkert <dan@danburkert.com>
Reviewed-by: Dan Burkert <dan@danburkert.com>


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

Branch: refs/heads/master
Commit: 8b04bf9753e400575e8497457feade91d2920103
Parents: 8ff679f
Author: Adar Dembo <adar@cloudera.com>
Authored: Tue Dec 22 13:15:27 2015 -0800
Committer: Dan Burkert <dan@danburkert.com>
Committed: Tue Jan 5 22:46:48 2016 +0000

----------------------------------------------------------------------
 CMakeLists.txt                         | 15 +++++++++++++--
 src/kudu/client/samples/CMakeLists.txt |  3 +++
 thirdparty/build-thirdparty.sh         |  8 ++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/8b04bf97/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 58a4b2b..701b66b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,13 +56,24 @@ endif()
 #    integers
 #  -Wno-deprecated: some of the gutil code includes old things like ext/hash_set, ignore
that
 #  - pthread: enable multithreaded malloc
-#  - -D__STDC_FORMAT_MACROS: for PRI* print format macros
 #  -fno-strict-aliasing
 #     Assume programs do not follow strict aliasing rules.
 #     GCC cannot always verify whether strict aliasing rules are indeed followed due to
 #     fundamental limitations in escape analysis, which can result in subtle bad code generation.
 #     This has a small perf hit but worth it to avoid hard to debug crashes.
-set(CXX_COMMON_FLAGS "-fno-strict-aliasing -msse4.2 -Wall -Wno-sign-compare -Wno-deprecated
-pthread -D__STDC_FORMAT_MACROS")
+set(CXX_COMMON_FLAGS "-fno-strict-aliasing -msse4.2 -Wall -Wno-sign-compare -Wno-deprecated
-pthread")
+
+# We want access to the PRI* print format macros.
+add_definitions(-D__STDC_FORMAT_MACROS)
+
+# Explicitly disable the new gcc5 ABI. Until clang supports abi tags [1], Kudu's
+# generated code (which always uses clang) must be built against the old ABI.
+# There's no recourse for using both ABIs in the same process; gcc's advice [2]
+# is to build everything against the old ABI.
+#
+# 1. https://llvm.org/bugs/show_bug.cgi?id=23529
+# 2. https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
+add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
 
 # We want short macros from util/status.h.
 add_definitions(-DKUDU_HEADERS_USE_SHORT_STATUS_MACROS=1)

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/8b04bf97/src/kudu/client/samples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/kudu/client/samples/CMakeLists.txt b/src/kudu/client/samples/CMakeLists.txt
index cb549f6..d6f9c54 100644
--- a/src/kudu/client/samples/CMakeLists.txt
+++ b/src/kudu/client/samples/CMakeLists.txt
@@ -25,5 +25,8 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
 endif()
 
+# The Kudu client library always uses the old gcc ABI.
+add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
+
 add_executable(sample sample.cc)
 target_link_libraries(sample kudu_client)

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/8b04bf97/thirdparty/build-thirdparty.sh
----------------------------------------------------------------------
diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index 25debd4..622b55b 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -27,6 +27,14 @@ DEBUG_CFLAGS="-g -fno-omit-frame-pointer"
 EXTRA_CXXFLAGS="-O2 $DEBUG_CFLAGS $CXXFLAGS "
 if [[ "$OSTYPE" =~ ^linux ]]; then
   OS_LINUX=1
+  # Explicitly disable the new gcc5 ABI. Until clang supports abi tags [1],
+  # Kudu's generated code (which always uses clang) must be built against the
+  # old ABI. There's no recourse for using both ABIs in the same process; gcc's
+  # advice [2] is to build everything against the old ABI.
+  #
+  # 1. https://llvm.org/bugs/show_bug.cgi?id=23529
+  # 2. https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
+  EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
   DYLIB_SUFFIX="so"
 elif [[ "$OSTYPE" == "darwin"* ]]; then
   OS_OSX=1


Mime
View raw message