From c745f1d2c4b72a58874605c5da4180a4cb9a0366 Mon Sep 17 00:00:00 2001 From: Nathan Bronson Date: Fri, 6 Nov 2015 09:04:28 -0800 Subject: [PATCH] Fix TSAN build for fbcode Summary: TSAN builds for gcc 4.9 need a PIC version of the libraries taken from the fbcode platform. This is accomplished by assuming every .a has a _pic.a sibling, and by fixing the third-party2 zlib build. Test Plan: make COMPILE_WITH_TSAN=1 check Reviewers: sdong, igor Reviewed By: igor Subscribers: dhruba Differential Revision: https://reviews.facebook.net/D50331 --- Makefile | 6 ++++-- build_tools/fbcode_config.sh | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index bbb59891f..9b96248f6 100644 --- a/Makefile +++ b/Makefile @@ -155,8 +155,10 @@ ifdef COMPILE_WITH_TSAN EXEC_LDFLAGS += -fsanitize=thread -pie PLATFORM_CCFLAGS += -fsanitize=thread -fPIC -DROCKSDB_TSAN_RUN PLATFORM_CXXFLAGS += -fsanitize=thread -fPIC -DROCKSDB_TSAN_RUN - # Turn off -pg when enabling TSAN testing, because that induces - # a link failure. TODO: find the root cause + # Use PIC versions of any precompiled libraries + EXEC_LDFLAGS := $(shell echo "$(EXEC_LDFLAGS)" | sed -e 's/[.]a /_pic.a /g') + # Turn off -pg when enabling TSAN testing, because that induces + # a link failure. TODO: find the root cause pg = else pg = -pg diff --git a/build_tools/fbcode_config.sh b/build_tools/fbcode_config.sh index d6c7b2a28..469282338 100644 --- a/build_tools/fbcode_config.sh +++ b/build_tools/fbcode_config.sh @@ -30,8 +30,8 @@ CFLAGS+=" -DSNAPPY" if test -z $PIC_BUILD; then # location of zlib headers and libraries - ZLIB_INCLUDE=" -I /mnt/gvfs/third-party2/zlib/feb983d9667f4cf5e9da07ce75abc824764b67a1/1.2.8/gcc-4.9-glibc-2.20/4230243/include/" - ZLIB_LIBS=" /mnt/gvfs/third-party2/zlib/feb983d9667f4cf5e9da07ce75abc824764b67a1/1.2.8/gcc-4.9-glibc-2.20/4230243/lib/libz.a" + ZLIB_INCLUDE=" -I /mnt/gvfs/third-party2/zlib/bdbc7c65a775f6b1c6ae43d677b1d380720dba7c/1.2.8/gcc-4.9-glibc-2.20/e9936bf/include/" + ZLIB_LIBS=" /mnt/gvfs/third-party2/zlib/bdbc7c65a775f6b1c6ae43d677b1d380720dba7c/1.2.8/gcc-4.9-glibc-2.20/e9936bf/lib/libz.a" CFLAGS+=" -DZLIB" # location of bzip headers and libraries -- GitLab