Skip to content

Commit 30ca375

Browse files
committed
Revamp our build tools
Summary: This diff is revamping our build tools: 1) Use third-party2 instead of third-party 2) consolidate clang and gcc scripts together, lots of duplication there 3) remove hdfs libs, we never compile rocksdb with them clang compilation doesn't work yet. It doesn't work in master either. I plan to fix it soon, but I just spent 2 hours trying to make it work and failed. I'll ask experts. Test Plan: compiles with gcc Reviewers: ljin, yhchiang, rven, sdong Reviewed By: sdong Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D28047
1 parent 051c67f commit 30ca375

File tree

5 files changed

+107
-241
lines changed

5 files changed

+107
-241
lines changed

build_tools/build_detect_platform

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,7 @@ COMMON_FLAGS="-DROCKSDB_PLATFORM_POSIX"
4848
# Default to fbcode gcc on internal fb machines
4949
if [ -z "$ROCKSDB_NO_FBCODE" -a -d /mnt/gvfs/third-party ]; then
5050
FBCODE_BUILD="true"
51-
if [ -z "$USE_CLANG" ]; then
52-
CENTOS_VERSION=`rpm -q --qf "%{VERSION}" \
53-
$(rpm -q --whatprovides redhat-release)`
54-
if [ "$CENTOS_VERSION" = "6" ]; then
55-
source "$PWD/build_tools/fbcode.gcc481.sh"
56-
else
57-
source "$PWD/build_tools/fbcode.gcc471.sh"
58-
fi
59-
else
60-
source "$PWD/build_tools/fbcode.clang31.sh"
61-
fi
51+
source "$PWD/build_tools/fbcode_config.sh"
6252
fi
6353

6454
# Delete existing output, if it exists

build_tools/fbcode.clang31.sh

Lines changed: 0 additions & 74 deletions
This file was deleted.

build_tools/fbcode.gcc471.sh

Lines changed: 0 additions & 70 deletions
This file was deleted.

build_tools/fbcode.gcc481.sh

Lines changed: 0 additions & 86 deletions
This file was deleted.

build_tools/fbcode_config.sh

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/bin/sh
2+
#
3+
# Set environment variables so that we can compile rocksdb using
4+
# fbcode settings. It uses the latest g++ compiler and also
5+
# uses jemalloc
6+
7+
# location of libgcc
8+
LIBGCC_BASE="/mnt/gvfs/third-party2/libgcc/7712e757d7355cb51292454ee0b7b46a467fdfed/4.8.1/gcc-4.8.1-glibc-2.17/8aac7fc"
9+
LIBGCC_INCLUDE="$LIBGCC_BASE/include"
10+
LIBGCC_LIBS=" -L $LIBGCC_BASE/libs"
11+
12+
# location of glibc
13+
GLIBC_REV=6e40560b4e0b6d690fd1cf8c7a43ad7452b04cfa
14+
GLIBC_INCLUDE="/mnt/gvfs/third-party2/glibc/$GLIBC_REV/2.17/gcc-4.8.1-glibc-2.17/99df8fc/include"
15+
GLIBC_LIBS=" -L /mnt/gvfs/third-party2/glibc/$GLIBC_REV/2.17/gcc-4.8.1-glibc-2.17/99df8fc/lib"
16+
17+
# location of snappy headers and libraries
18+
SNAPPY_INCLUDE=" -I /mnt/gvfs/third-party2/snappy/aef17f6c0b44b4fe408bd06f67c93701ab0a6ceb/1.0.3/gcc-4.8.1-glibc-2.17/43d84e2/include"
19+
SNAPPY_LIBS=" /mnt/gvfs/third-party2/snappy/aef17f6c0b44b4fe408bd06f67c93701ab0a6ceb/1.0.3/gcc-4.8.1-glibc-2.17/43d84e2/lib/libsnappy.a"
20+
21+
# location of zlib headers and libraries
22+
ZLIB_INCLUDE=" -I /mnt/gvfs/third-party2/zlib/25c6216928b4d77b59ddeca0990ff6fe9ac16b81/1.2.5/gcc-4.8.1-glibc-2.17/c3f970a/include"
23+
ZLIB_LIBS=" /mnt/gvfs/third-party2/zlib/25c6216928b4d77b59ddeca0990ff6fe9ac16b81/1.2.5/gcc-4.8.1-glibc-2.17/c3f970a/lib/libz.a"
24+
25+
# location of bzip headers and libraries
26+
BZIP_INCLUDE=" -I /mnt/gvfs/third-party2/bzip2/c9ef7629c2aa0024f7a416e87602f06eb88f5eac/1.0.6/gcc-4.8.1-glibc-2.17/c3f970a/include/"
27+
BZIP_LIBS=" /mnt/gvfs/third-party2/bzip2/c9ef7629c2aa0024f7a416e87602f06eb88f5eac/1.0.6/gcc-4.8.1-glibc-2.17/c3f970a/lib/libbz2.a"
28+
29+
LZ4_REV=065ec7e38fe83329031f6668c43bef83eff5808b
30+
LZ4_INCLUDE=" -I /mnt/gvfs/third-party2/lz4/$LZ4_REV/r108/gcc-4.8.1-glibc-2.17/c3f970a/include"
31+
LZ4_LIBS=" /mnt/gvfs/third-party2/lz4/$LZ4_REV/r108/gcc-4.8.1-glibc-2.17/c3f970a/lib/liblz4.a"
32+
33+
# location of gflags headers and libraries
34+
GFLAGS_INCLUDE=" -I /mnt/gvfs/third-party2/gflags/1ad047a6e6f6673991918ecadc670868205a243a/1.6/gcc-4.8.1-glibc-2.17/c3f970a/include/"
35+
GFLAGS_LIBS=" /mnt/gvfs/third-party2/gflags/1ad047a6e6f6673991918ecadc670868205a243a/1.6/gcc-4.8.1-glibc-2.17/c3f970a/lib/libgflags.a"
36+
37+
# location of jemalloc
38+
JEMALLOC_INCLUDE=" -I /mnt/gvfs/third-party2/jemalloc/c60d854f7824f334195fe7fd34b2bc9057e3c1f9/3.6.0/gcc-4.8.1-glibc-2.17/4d53c6f/include"
39+
JEMALLOC_LIB=" -Wl,--whole-archive /mnt/gvfs/third-party2/jemalloc/c60d854f7824f334195fe7fd34b2bc9057e3c1f9/3.6.0/gcc-4.8.1-glibc-2.17/4d53c6f/lib/libjemalloc.a"
40+
41+
# location of numa
42+
NUMA_REV=829d10dac0230f99cd7e1778869d2adf3da24b65
43+
NUMA_INCLUDE=" -I /mnt/gvfs/third-party2/numa/$NUMA_REV/2.0.8/gcc-4.8.1-glibc-2.17/c3f970a/include/"
44+
NUMA_LIB=" /mnt/gvfs/third-party2/numa/$NUMA_REV/2.0.8/gcc-4.8.1-glibc-2.17/c3f970a/lib/libnuma.a"
45+
46+
# location of libunwind
47+
LIBUNWIND_REV=2c060e64064559905d46fd194000d61592087bdc
48+
LIBUNWIND="/mnt/gvfs/third-party2/libunwind/$LIBUNWIND_REV/1.1/gcc-4.8.1-glibc-2.17/675d945/lib/libunwind.a"
49+
50+
# use Intel SSE support for checksum calculations
51+
export USE_SSE=" -msse -msse4.2 "
52+
53+
BINUTILS="/mnt/gvfs/third-party2/binutils/2aff2e7b474cd3e6ab23495ad1224b7d214b9f8e/2.21.1/centos6-native/da39a3e/bin"
54+
AR="$BINUTILS/ar"
55+
56+
DEPS_INCLUDE="$SNAPPY_INCLUDE $ZLIB_INCLUDE $BZIP_INCLUDE $LZ4_INCLUDE $GFLAGS_INCLUDE $NUMA_INCLUDE"
57+
58+
GCC_BASE="/mnt/gvfs/third-party2/gcc/1ec615e23800f0815d474478ba476a0adc3fe788/4.8.1/centos6-native/cc6c9dc"
59+
STDLIBS="-L $GCC_BASE/lib64"
60+
61+
if [ -z "$USE_CLANG" ]; then
62+
# gcc
63+
CC="$GCC_BASE/bin/gcc"
64+
CXX="$GCC_BASE/bin/g++"
65+
66+
CFLAGS="-B$BINUTILS/gold -m64 -mtune=generic"
67+
CFLAGS+=" -I $LIBGCC_INCLUDE -I $GLIBC_INCLUDE"
68+
CFLAGS+=" $DEPS_INCLUDE"
69+
CFLAGS+=" -DROCKSDB_PLATFORM_POSIX -DROCKSDB_FALLOCATE_PRESENT"
70+
CFLAGS+=" -DSNAPPY -DGFLAGS=google -DZLIB -DBZIP2 -DLZ4 -DNUMA"
71+
else
72+
# clang
73+
CLANG_BASE="/mnt/gvfs/third-party2/clang/9ab68376f938992c4eb5946ca68f90c3185cffc8/3.4"
74+
CLANG_INCLUDE="$CLANG_BASE/gcc-4.8.1-glibc-2.17/fb0f730/lib/clang/3.4/include"
75+
CC="$CLANG_BASE/centos6-native/9cefd8a/bin/clang"
76+
CXX="$CLANG_BASE/centos6-native/9cefd8a/bin/clang++"
77+
78+
KERNEL_HEADERS_INCLUDE="/mnt/gvfs/third-party2/kernel-headers/a683ed7135276731065a9d76d3016c9731f4e2f9/3.2.18_70_fbk11_00129_gc8882d0/gcc-4.8.1-glibc-2.17/da39a3e/include/"
79+
80+
CFLAGS="-B$BINUTILS -nostdinc -nostdlib"
81+
CFLAGS+=" -isystem $LIBGCC_BASE/include/c++/4.8.1 "
82+
CFLAGS+=" -isystem $LIBGCC_BASE/include/c++/4.8.1/x86_64-facebook-linux "
83+
CFLAGS+=" -isystem $GLIBC_INCLUDE"
84+
CFLAGS+=" -isystem $LIBGCC_INCLUDE"
85+
CFLAGS+=" -isystem $CLANG_INCLUDE"
86+
CFLAGS+=" -isystem $KERNEL_HEADERS_INCLUDE/linux "
87+
CFLAGS+=" -isystem $KERNEL_HEADERS_INCLUDE "
88+
CFLAGS+=" -Wall -Wno-sign-compare -Wno-unused-variable -Winvalid-pch -Wno-deprecated -Woverloaded-virtual"
89+
CFLAGS+=" $DEPS_INCLUDE"
90+
CFLAGS+=" -DROCKSDB_PLATFORM_POSIX -DROCKSDB_FALLOCATE_PRESENT"
91+
CFLAGS+=" -DSNAPPY -DGFLAGS=google -DZLIB -DBZIP2 -DLZ4 -DNUMA"
92+
CXXFLAGS="$CFLAGS -nostdinc++"
93+
fi
94+
95+
EXEC_LDFLAGS=" $SNAPPY_LIBS $ZLIB_LIBS $BZIP_LIBS $LZ4_LIBS $GFLAGS_LIBS $NUMA_LIB"
96+
EXEC_LDFLAGS+=" -Wl,--dynamic-linker,/usr/local/fbcode/gcc-4.8.1-glibc-2.17/lib/ld.so"
97+
EXEC_LDFLAGS+=" -Wl,--no-whole-archive $LIBUNWIND"
98+
99+
PLATFORM_LDFLAGS="$LIBGCC_LIBS $GLIBC_LIBS $STDLIBS -lgcc -lstdc++"
100+
101+
EXEC_LDFLAGS_SHARED="$SNAPPY_LIBS $ZLIB_LIBS $BZIP_LIBS $LZ4_LIBS $GFLAGS_LIBS"
102+
103+
VALGRIND_REV=b2a9f85e4b70cd03abc85a7f3027fbc4cef35bd0
104+
VALGRIND_VER="/mnt/gvfs/third-party2/valgrind/$VALGRIND_REV/3.8.1/gcc-4.8.1-glibc-2.17/c3f970a/bin/"
105+
106+
export CC CXX AR CFLAGS CXXFLAGS EXEC_LDFLAGS EXEC_LDFLAGS_SHARED VALGRIND_VER JEMALLOC_LIB JEMALLOC_INCLUDE

0 commit comments

Comments
 (0)