From 5884cf5d5b22fc711aa16006542a3d3c67163fe4 Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Mon, 29 Mar 2021 16:31:26 -0700 Subject: [PATCH] range_tree requires GNU libc on ppc64 (#8070) Summary: If the platform is ppc64 and the libc is not GNU libc, then we exclude the range_tree from compilation. See https://jira.percona.com/browse/PS-7559 Pull Request resolved: https://github.com/facebook/rocksdb/pull/8070 Reviewed By: jay-zhuang Differential Revision: D27246004 Pulled By: mrambacher fbshipit-source-id: 59d8433242ce7ce608988341becb4f83312445f5 --- Makefile | 6 ++++++ buckifier/buckify_rocksdb.py | 4 ++++ build_tools/build_detect_platform | 20 ++++++++++++++++++++ src.mk | 26 ++++++++++++++------------ 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 7c865532c..000f3ac2c 100644 --- a/Makefile +++ b/Makefile @@ -510,6 +510,12 @@ ifeq ($(USE_FOLLY_DISTRIBUTED_MUTEX),1) LIB_OBJECTS += $(patsubst %.cpp, $(OBJ_DIR)/%.o, $(FOLLY_SOURCES)) endif +# range_tree is not compatible with non GNU libc on ppc64 +# see https://jira.percona.com/browse/PS-7559 +ifneq ($(PPC_LIBC_IS_GNU),0) + LIB_OBJECTS += $(patsubst %.cc, $(OBJ_DIR)/%.o, $(RANGE_TREE_SOURCES)) +endif + GTEST = $(OBJ_DIR)/$(GTEST_DIR)/gtest/gtest-all.o TESTUTIL = $(OBJ_DIR)/test_util/testutil.o TESTHARNESS = $(OBJ_DIR)/test_util/testharness.o $(TESTUTIL) $(GTEST) diff --git a/buckifier/buckify_rocksdb.py b/buckifier/buckify_rocksdb.py index f0909bc61..aac33a244 100644 --- a/buckifier/buckify_rocksdb.py +++ b/buckifier/buckify_rocksdb.py @@ -135,11 +135,15 @@ def generate_targets(repo_path, deps_map): TARGETS.add_library( "rocksdb_lib", src_mk["LIB_SOURCES"] + + # always add range_tree, it's only excluded on ppc64, which we don't use internally + src_mk["RANGE_TREE_SOURCES"] + src_mk["TOOL_LIB_SOURCES"]) # rocksdb_whole_archive_lib TARGETS.add_library( "rocksdb_whole_archive_lib", src_mk["LIB_SOURCES"] + + # always add range_tree, it's only excluded on ppc64, which we don't use internally + src_mk["RANGE_TREE_SOURCES"] + src_mk["TOOL_LIB_SOURCES"], deps=None, headers=None, diff --git a/build_tools/build_detect_platform b/build_tools/build_detect_platform index a686ab06d..3c219ec12 100755 --- a/build_tools/build_detect_platform +++ b/build_tools/build_detect_platform @@ -663,6 +663,23 @@ else fi fi +if test -n "`echo $TARGET_ARCHITECTURE | grep ^ppc64`"; then + # check for GNU libc on ppc64 + $CXX -x c++ - -o /dev/null 2>/dev/null < + #include + #include + + int main(int argc, char *argv[]) { + printf("GNU libc version: %s\n", gnu_get_libc_version()); + return 0; + } +EOF + if [ "$?" != 0 ]; then + PPC_LIBC_IS_GNU=0 + fi +fi + if test "$TRY_SSE_ETC"; then # The USE_SSE flag now means "attempt to compile with widely-available # Intel architecture extensions utilized by specific optimizations in the @@ -856,3 +873,6 @@ echo "LUA_PATH=$LUA_PATH" >> "$OUTPUT" if test -n "$USE_FOLLY_DISTRIBUTED_MUTEX"; then echo "USE_FOLLY_DISTRIBUTED_MUTEX=$USE_FOLLY_DISTRIBUTED_MUTEX" >> "$OUTPUT" fi +if test -n "$PPC_LIBC_IS_GNU"; then + echo "PPC_LIBC_IS_GNU=$PPC_LIBC_IS_GNU" >> "$OUTPUT" +fi diff --git a/src.mk b/src.mk index 2f8077d5b..f03bada34 100644 --- a/src.mk +++ b/src.mk @@ -255,18 +255,6 @@ LIB_SOURCES = \ utilities/transactions/lock/lock_manager.cc \ utilities/transactions/lock/point/point_lock_tracker.cc \ utilities/transactions/lock/point/point_lock_manager.cc \ - utilities/transactions/lock/range/range_tree/lib/locktree/concurrent_tree.cc \ - utilities/transactions/lock/range/range_tree/lib/locktree/keyrange.cc \ - utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.cc \ - utilities/transactions/lock/range/range_tree/lib/locktree/locktree.cc \ - utilities/transactions/lock/range/range_tree/lib/locktree/manager.cc \ - utilities/transactions/lock/range/range_tree/lib/locktree/range_buffer.cc \ - utilities/transactions/lock/range/range_tree/lib/locktree/treenode.cc \ - utilities/transactions/lock/range/range_tree/lib/locktree/txnid_set.cc \ - utilities/transactions/lock/range/range_tree/lib/locktree/wfg.cc \ - utilities/transactions/lock/range/range_tree/lib/standalone_port.cc \ - utilities/transactions/lock/range/range_tree/lib/util/dbt.cc \ - utilities/transactions/lock/range/range_tree/lib/util/memarena.cc \ utilities/transactions/optimistic_transaction.cc \ utilities/transactions/optimistic_transaction_db_impl.cc \ utilities/transactions/pessimistic_transaction.cc \ @@ -298,6 +286,20 @@ LIB_SOURCES_ASM = LIB_SOURCES_C = endif +RANGE_TREE_SOURCES =\ + utilities/transactions/lock/range/range_tree/lib/locktree/concurrent_tree.cc \ + utilities/transactions/lock/range/range_tree/lib/locktree/keyrange.cc \ + utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.cc \ + utilities/transactions/lock/range/range_tree/lib/locktree/locktree.cc \ + utilities/transactions/lock/range/range_tree/lib/locktree/manager.cc \ + utilities/transactions/lock/range/range_tree/lib/locktree/range_buffer.cc \ + utilities/transactions/lock/range/range_tree/lib/locktree/treenode.cc \ + utilities/transactions/lock/range/range_tree/lib/locktree/txnid_set.cc \ + utilities/transactions/lock/range/range_tree/lib/locktree/wfg.cc \ + utilities/transactions/lock/range/range_tree/lib/standalone_port.cc \ + utilities/transactions/lock/range/range_tree/lib/util/dbt.cc \ + utilities/transactions/lock/range/range_tree/lib/util/memarena.cc + TOOL_LIB_SOURCES = \ tools/io_tracer_parser_tool.cc \ tools/ldb_cmd.cc \