Add latest toolchain (gcc-8, etc.) build support for fbcode users (#4923)
Summary: - When building with internal dependencies, specify this toolchain by setting `ROCKSDB_FBCODE_BUILD_WITH_PLATFORM007=1` - It is not enabled by default. However, it is enabled for TSAN builds in CI since there is a known problem with TSAN in gcc-5: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71090 - I did not add support for Lua since (1) we agreed to deprecate it, and (2) we only have an internal build for v5.3 with this toolchain while that has breaking changes compared to our current version (v5.2). Pull Request resolved: https://github.com/facebook/rocksdb/pull/4923 Differential Revision: D13827226 Pulled By: ajkr fbshipit-source-id: 9aa3388ed3679777cfb15ef8cbcb83c07f62f947main
parent
bc7d1661a8
commit
e242fa4664
@ -0,0 +1,18 @@ |
||||
GCC_BASE=/mnt/gvfs/third-party2/gcc/6e8e715624fd15256a7970073387793dfcf79b46/7.x/centos7-native/b2ef2b6 |
||||
CLANG_BASE=/mnt/gvfs/third-party2/llvm-fb/ef37e1faa1c29782abfac1ae65a291b9b7966f6d/stable/centos7-native/c9f9104 |
||||
LIBGCC_BASE=/mnt/gvfs/third-party2/libgcc/c67031f0f739ac61575a061518d6ef5038f99f90/7.x/platform007/5620abc |
||||
GLIBC_BASE=/mnt/gvfs/third-party2/glibc/60d6f124a78798b73944f5ba87c2306ae3460153/2.26/platform007/f259413 |
||||
SNAPPY_BASE=/mnt/gvfs/third-party2/snappy/7f9bdaada18f59bc27ec2b0871eb8a6144343aef/1.1.3/platform007/ca4da3d |
||||
ZLIB_BASE=/mnt/gvfs/third-party2/zlib/22c2d65676fb7c23cfa797c4f6937f38b026f3cf/1.2.8/platform007/ca4da3d |
||||
BZIP2_BASE=/mnt/gvfs/third-party2/bzip2/dc49a21c5fceec6456a7a28a94dcd16690af1337/1.0.6/platform007/ca4da3d |
||||
LZ4_BASE=/mnt/gvfs/third-party2/lz4/907b498203d297947f3bb70b9466f47e100f1873/r131/platform007/ca4da3d |
||||
ZSTD_BASE=/mnt/gvfs/third-party2/zstd/3ee276cbacfad3074e3f07bf826ac47f06970f4e/1.3.5/platform007/15a3614 |
||||
GFLAGS_BASE=/mnt/gvfs/third-party2/gflags/0b9929d2588991c65a57168bf88aff2db87c5d48/2.2.0/platform007/ca4da3d |
||||
JEMALLOC_BASE=/mnt/gvfs/third-party2/jemalloc/9c910d36d6235cc40e8ff559358f1833452300ca/master/platform007/5b0f53e |
||||
NUMA_BASE=/mnt/gvfs/third-party2/numa/9cbf2460284c669ed19c3ccb200a71f7dd7e53c7/2.0.11/platform007/ca4da3d |
||||
LIBUNWIND_BASE=/mnt/gvfs/third-party2/libunwind/bf3d7497fe4e6d007354f0adffa16ce3003f8338/1.3/platform007/6f3e0a9 |
||||
TBB_BASE=/mnt/gvfs/third-party2/tbb/ff4e0b093534704d8abab678a4fd7f5ea7b094c7/2018_U5/platform007/ca4da3d |
||||
KERNEL_HEADERS_BASE=/mnt/gvfs/third-party2/kernel-headers/b5c4a61a5c483ba24722005ae07895971a2ac707/fb/platform007/da39a3e |
||||
BINUTILS_BASE=/mnt/gvfs/third-party2/binutils/92ff90349e2f43ea0a8246d8b1cf17b6869013e3/2.29.1/centos7-native/da39a3e |
||||
VALGRIND_BASE=/mnt/gvfs/third-party2/valgrind/f3f697a28122e6bcd513273dd9c1ff23852fc59f/3.13.0/platform007/ca4da3d |
||||
LUA_BASE=/mnt/gvfs/third-party2/lua/f0cd714433206d5139df61659eb7b28b1dea6683/5.3.4/platform007/5007832 |
@ -0,0 +1,157 @@ |
||||
#!/bin/sh |
||||
# |
||||
# Set environment variables so that we can compile rocksdb using |
||||
# fbcode settings. It uses the latest g++ and clang compilers and also |
||||
# uses jemalloc |
||||
# Environment variables that change the behavior of this script: |
||||
# PIC_BUILD -- if true, it will only take pic versions of libraries from fbcode. libraries that don't have pic variant will not be included |
||||
|
||||
|
||||
BASEDIR=`dirname $BASH_SOURCE` |
||||
source "$BASEDIR/dependencies_platform007.sh" |
||||
|
||||
CFLAGS="" |
||||
|
||||
# libgcc |
||||
LIBGCC_INCLUDE="$LIBGCC_BASE/include/c++/7.3.0" |
||||
LIBGCC_LIBS=" -L $LIBGCC_BASE/lib" |
||||
|
||||
# glibc |
||||
GLIBC_INCLUDE="$GLIBC_BASE/include" |
||||
GLIBC_LIBS=" -L $GLIBC_BASE/lib" |
||||
|
||||
# snappy |
||||
SNAPPY_INCLUDE=" -I $SNAPPY_BASE/include/" |
||||
if test -z $PIC_BUILD; then |
||||
SNAPPY_LIBS=" $SNAPPY_BASE/lib/libsnappy.a" |
||||
else |
||||
SNAPPY_LIBS=" $SNAPPY_BASE/lib/libsnappy_pic.a" |
||||
fi |
||||
CFLAGS+=" -DSNAPPY" |
||||
|
||||
if test -z $PIC_BUILD; then |
||||
# location of zlib headers and libraries |
||||
ZLIB_INCLUDE=" -I $ZLIB_BASE/include/" |
||||
ZLIB_LIBS=" $ZLIB_BASE/lib/libz.a" |
||||
CFLAGS+=" -DZLIB" |
||||
|
||||
# location of bzip headers and libraries |
||||
BZIP_INCLUDE=" -I $BZIP2_BASE/include/" |
||||
BZIP_LIBS=" $BZIP2_BASE/lib/libbz2.a" |
||||
CFLAGS+=" -DBZIP2" |
||||
|
||||
LZ4_INCLUDE=" -I $LZ4_BASE/include/" |
||||
LZ4_LIBS=" $LZ4_BASE/lib/liblz4.a" |
||||
CFLAGS+=" -DLZ4" |
||||
fi |
||||
|
||||
ZSTD_INCLUDE=" -I $ZSTD_BASE/include/" |
||||
if test -z $PIC_BUILD; then |
||||
ZSTD_LIBS=" $ZSTD_BASE/lib/libzstd.a" |
||||
else |
||||
ZSTD_LIBS=" $ZSTD_BASE/lib/libzstd_pic.a" |
||||
fi |
||||
CFLAGS+=" -DZSTD" |
||||
|
||||
# location of gflags headers and libraries |
||||
GFLAGS_INCLUDE=" -I $GFLAGS_BASE/include/" |
||||
if test -z $PIC_BUILD; then |
||||
GFLAGS_LIBS=" $GFLAGS_BASE/lib/libgflags.a" |
||||
else |
||||
GFLAGS_LIBS=" $GFLAGS_BASE/lib/libgflags_pic.a" |
||||
fi |
||||
CFLAGS+=" -DGFLAGS=gflags" |
||||
|
||||
# location of jemalloc |
||||
JEMALLOC_INCLUDE=" -I $JEMALLOC_BASE/include/" |
||||
JEMALLOC_LIB=" $JEMALLOC_BASE/lib/libjemalloc.a" |
||||
|
||||
if test -z $PIC_BUILD; then |
||||
# location of numa |
||||
NUMA_INCLUDE=" -I $NUMA_BASE/include/" |
||||
NUMA_LIB=" $NUMA_BASE/lib/libnuma.a" |
||||
CFLAGS+=" -DNUMA" |
||||
|
||||
# location of libunwind |
||||
LIBUNWIND="$LIBUNWIND_BASE/lib/libunwind.a" |
||||
fi |
||||
|
||||
# location of TBB |
||||
TBB_INCLUDE=" -isystem $TBB_BASE/include/" |
||||
if test -z $PIC_BUILD; then |
||||
TBB_LIBS="$TBB_BASE/lib/libtbb.a" |
||||
else |
||||
TBB_LIBS="$TBB_BASE/lib/libtbb_pic.a" |
||||
fi |
||||
CFLAGS+=" -DTBB" |
||||
|
||||
# use Intel SSE support for checksum calculations |
||||
export USE_SSE=1 |
||||
export PORTABLE=1 |
||||
|
||||
BINUTILS="$BINUTILS_BASE/bin" |
||||
AR="$BINUTILS/ar" |
||||
|
||||
DEPS_INCLUDE="$SNAPPY_INCLUDE $ZLIB_INCLUDE $BZIP_INCLUDE $LZ4_INCLUDE $ZSTD_INCLUDE $GFLAGS_INCLUDE $NUMA_INCLUDE $TBB_INCLUDE" |
||||
|
||||
STDLIBS="-L $GCC_BASE/lib64" |
||||
|
||||
CLANG_BIN="$CLANG_BASE/bin" |
||||
CLANG_LIB="$CLANG_BASE/lib" |
||||
CLANG_SRC="$CLANG_BASE/../../src" |
||||
|
||||
CLANG_ANALYZER="$CLANG_BIN/clang++" |
||||
CLANG_SCAN_BUILD="$CLANG_SRC/llvm/tools/clang/tools/scan-build/bin/scan-build" |
||||
|
||||
if [ -z "$USE_CLANG" ]; then |
||||
# gcc |
||||
CC="$GCC_BASE/bin/gcc" |
||||
CXX="$GCC_BASE/bin/g++" |
||||
|
||||
CFLAGS+=" -B$BINUTILS/gold" |
||||
CFLAGS+=" -isystem $LIBGCC_INCLUDE" |
||||
CFLAGS+=" -isystem $GLIBC_INCLUDE" |
||||
JEMALLOC=1 |
||||
else |
||||
# clang |
||||
CLANG_INCLUDE="$CLANG_LIB/clang/stable/include" |
||||
CC="$CLANG_BIN/clang" |
||||
CXX="$CLANG_BIN/clang++" |
||||
|
||||
KERNEL_HEADERS_INCLUDE="$KERNEL_HEADERS_BASE/include" |
||||
|
||||
CFLAGS+=" -B$BINUTILS/gold -nostdinc -nostdlib" |
||||
CFLAGS+=" -isystem $LIBGCC_BASE/include/c++/7.x " |
||||
CFLAGS+=" -isystem $LIBGCC_BASE/include/c++/7.x/x86_64-facebook-linux " |
||||
CFLAGS+=" -isystem $GLIBC_INCLUDE" |
||||
CFLAGS+=" -isystem $LIBGCC_INCLUDE" |
||||
CFLAGS+=" -isystem $CLANG_INCLUDE" |
||||
CFLAGS+=" -isystem $KERNEL_HEADERS_INCLUDE/linux " |
||||
CFLAGS+=" -isystem $KERNEL_HEADERS_INCLUDE " |
||||
CFLAGS+=" -Wno-expansion-to-defined " |
||||
CXXFLAGS="-nostdinc++" |
||||
fi |
||||
|
||||
CFLAGS+=" $DEPS_INCLUDE" |
||||
CFLAGS+=" -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DROCKSDB_FALLOCATE_PRESENT -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_SUPPORT_THREAD_LOCAL -DHAVE_SSE42" |
||||
CXXFLAGS+=" $CFLAGS" |
||||
|
||||
EXEC_LDFLAGS=" $SNAPPY_LIBS $ZLIB_LIBS $BZIP_LIBS $LZ4_LIBS $ZSTD_LIBS $GFLAGS_LIBS $NUMA_LIB $TBB_LIBS" |
||||
EXEC_LDFLAGS+=" -B$BINUTILS/gold" |
||||
EXEC_LDFLAGS+=" -Wl,--dynamic-linker,/usr/local/fbcode/platform007/lib/ld.so" |
||||
EXEC_LDFLAGS+=" $LIBUNWIND" |
||||
EXEC_LDFLAGS+=" -Wl,-rpath=/usr/local/fbcode/platform007/lib" |
||||
# required by libtbb |
||||
EXEC_LDFLAGS+=" -ldl" |
||||
|
||||
PLATFORM_LDFLAGS="$LIBGCC_LIBS $GLIBC_LIBS $STDLIBS -lgcc -lstdc++" |
||||
|
||||
EXEC_LDFLAGS_SHARED="$SNAPPY_LIBS $ZLIB_LIBS $BZIP_LIBS $LZ4_LIBS $ZSTD_LIBS $GFLAGS_LIBS $TBB_LIBS" |
||||
|
||||
VALGRIND_VER="$VALGRIND_BASE/bin/" |
||||
|
||||
# lua not supported because it's on track for deprecation, I think |
||||
LUA_PATH= |
||||
LUA_LIB= |
||||
|
||||
export CC CXX AR CFLAGS CXXFLAGS EXEC_LDFLAGS EXEC_LDFLAGS_SHARED VALGRIND_VER JEMALLOC_LIB JEMALLOC_INCLUDE CLANG_ANALYZER CLANG_SCAN_BUILD LUA_PATH LUA_LIB |
Loading…
Reference in new issue