Move the compiler back to 4.8.1 + more small fixes
Summary: 1. Moved the compiler back to 4.8.1 and uses Centos 5.2 binaries if OS is Centos 5.2. 2. Fixes this issue: https://github.com/facebook/rocksdb/issues/7 3. We use lot of c++11 features, so we can't pretend we can compile without them. Makes it a first class dependency. 4. Fix blob_store_test, which failes on Ubuntu with "too many files opened" error 5. Removed dependency on port/port_chromium.h, which does not even exist on our system Test Plan: make clean; make check Reviewers: dhruba, kailiu Reviewed By: kailiu CC: leveldb Differential Revision: https://reviews.facebook.net/D14145
This commit is contained in:
parent
6c6d5bc3b0
commit
f611aba559
2
Makefile
2
Makefile
@ -20,7 +20,7 @@ include build_config.mk
|
|||||||
|
|
||||||
WARNING_FLAGS = -Wall -Werror
|
WARNING_FLAGS = -Wall -Werror
|
||||||
CFLAGS += -g $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CCFLAGS) $(OPT)
|
CFLAGS += -g $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CCFLAGS) $(OPT)
|
||||||
CXXFLAGS += -g $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT) -std=gnu++0x -Woverloaded-virtual
|
CXXFLAGS += -g $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT) -Woverloaded-virtual
|
||||||
|
|
||||||
LDFLAGS += $(PLATFORM_LDFLAGS)
|
LDFLAGS += $(PLATFORM_LDFLAGS)
|
||||||
|
|
||||||
|
@ -37,12 +37,16 @@ if test -z "$OUTPUT"; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# we depend on C++11
|
||||||
|
PLATFORM_CXXFLAGS="-std=gnu++11"
|
||||||
|
# we currently depend on POSIX platform
|
||||||
|
COMMON_FLAGS="-DROCKSDB_PLATFORM_POSIX"
|
||||||
|
|
||||||
# Default to fbcode gcc on internal fb machines
|
# Default to fbcode gcc on internal fb machines
|
||||||
if [ -d /mnt/gvfs/third-party -a -z "$CXX" ]; then
|
if [ -d /mnt/gvfs/third-party -a -z "$CXX" ]; then
|
||||||
FBCODE_BUILD="true"
|
FBCODE_BUILD="true"
|
||||||
PLATFORM_CXXFLAGS="-std=c++0x"
|
|
||||||
if [ -z "$USE_CLANG" ]; then
|
if [ -z "$USE_CLANG" ]; then
|
||||||
source $PWD/build_tools/fbcode.gcc471.sh
|
source $PWD/build_tools/fbcode.gcc481.sh
|
||||||
else
|
else
|
||||||
source $PWD/build_tools/fbcode.clang31.sh
|
source $PWD/build_tools/fbcode.clang31.sh
|
||||||
fi
|
fi
|
||||||
@ -65,10 +69,10 @@ if test -z "$TARGET_OS"; then
|
|||||||
TARGET_OS=`uname -s`
|
TARGET_OS=`uname -s`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COMMON_FLAGS="${CFLAGS}"
|
COMMON_FLAGS="$COMMON_FLAGS ${CFLAGS}"
|
||||||
CROSS_COMPILE=
|
CROSS_COMPILE=
|
||||||
PLATFORM_CCFLAGS=
|
PLATFORM_CCFLAGS=
|
||||||
PLATFORM_CXXFLAGS="${CXXFLAGS}"
|
PLATFORM_CXXFLAGS="$PLATFORM_CXXFLAGS ${CXXFLAGS}"
|
||||||
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS"
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS"
|
||||||
PLATFORM_SHARED_EXT="so"
|
PLATFORM_SHARED_EXT="so"
|
||||||
PLATFORM_SHARED_LDFLAGS="${EXEC_LDFLAGS_SHARED} -shared -Wl,-soname -Wl,"
|
PLATFORM_SHARED_LDFLAGS="${EXEC_LDFLAGS_SHARED} -shared -Wl,-soname -Wl,"
|
||||||
@ -164,16 +168,13 @@ if [ "$CROSS_COMPILE" = "true" -o "$FBCODE_BUILD" = "true" ]; then
|
|||||||
# Also don't need any compilation tests if compiling on fbcode
|
# Also don't need any compilation tests if compiling on fbcode
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
# If -std=c++0x works, use <cstdatomic>. Otherwise use port_posix.h.
|
# If -std=c++0x works, use <atomic>. Otherwise use port_posix.h.
|
||||||
$CXX $CFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <<EOF
|
$CXX $CFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <<EOF
|
||||||
#include <cstdatomic>
|
#include <atomic>
|
||||||
int main() {}
|
int main() {}
|
||||||
EOF
|
EOF
|
||||||
if [ "$?" = 0 ]; then
|
if [ "$?" = 0 ]; then
|
||||||
COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX -DLEVELDB_CSTDATOMIC_PRESENT"
|
COMMON_FLAGS="$COMMON_FLAGS -DROCKSDB_ATOMIC_PRESENT"
|
||||||
PLATFORM_CXXFLAGS="-std=c++0x"
|
|
||||||
else
|
|
||||||
COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Test whether Snappy library is installed
|
# Test whether Snappy library is installed
|
||||||
|
@ -49,7 +49,7 @@ RANLIB=$TOOLCHAIN_EXECUTABLES/binutils/binutils-2.21.1/da39a3e/bin/ranlib
|
|||||||
|
|
||||||
CFLAGS="-B$TOOLCHAIN_EXECUTABLES/binutils/binutils-2.21.1/da39a3e/bin/gold -m64 -mtune=generic -fPIC"
|
CFLAGS="-B$TOOLCHAIN_EXECUTABLES/binutils/binutils-2.21.1/da39a3e/bin/gold -m64 -mtune=generic -fPIC"
|
||||||
CFLAGS+=" -I $TOOLCHAIN_LIB_BASE/jemalloc/$TOOL_JEMALLOC/include -DHAVE_JEMALLOC"
|
CFLAGS+=" -I $TOOLCHAIN_LIB_BASE/jemalloc/$TOOL_JEMALLOC/include -DHAVE_JEMALLOC"
|
||||||
CFLAGS+=" -DLEVELDB_PLATFORM_POSIX"
|
CFLAGS+=" -DROCKSDB_PLATFORM_POSIX -DROCKSDB_ATOMIC_PRESENT"
|
||||||
CFLAGS+=" -DSNAPPY -DGFLAGS -DZLIB -DBZIP2"
|
CFLAGS+=" -DSNAPPY -DGFLAGS -DZLIB -DBZIP2"
|
||||||
|
|
||||||
EXEC_LDFLAGS=" -Wl,--whole-archive $TOOLCHAIN_LIB_BASE/jemalloc/$TOOL_JEMALLOC/lib/libjemalloc.a"
|
EXEC_LDFLAGS=" -Wl,--whole-archive $TOOLCHAIN_LIB_BASE/jemalloc/$TOOL_JEMALLOC/lib/libjemalloc.a"
|
||||||
|
@ -5,7 +5,12 @@
|
|||||||
# uses jemalloc
|
# uses jemalloc
|
||||||
|
|
||||||
TOOLCHAIN_REV=53dc1fe83f84e9145b9ffb81b81aa7f6a49c87cc
|
TOOLCHAIN_REV=53dc1fe83f84e9145b9ffb81b81aa7f6a49c87cc
|
||||||
TOOLCHAIN_EXECUTABLES="/mnt/gvfs/third-party/$TOOLCHAIN_REV/centos6-native"
|
CENTOS_VERSION=`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`
|
||||||
|
if [ "$CENTOS_VERSION" = "6" ]; then
|
||||||
|
TOOLCHAIN_EXECUTABLES="/mnt/gvfs/third-party/$TOOLCHAIN_REV/centos6-native"
|
||||||
|
else
|
||||||
|
TOOLCHAIN_EXECUTABLES="/mnt/gvfs/third-party/$TOOLCHAIN_REV/centos5.2-native"
|
||||||
|
fi
|
||||||
TOOLCHAIN_LIB_BASE="/mnt/gvfs/third-party/$TOOLCHAIN_REV/gcc-4.8.1-glibc-2.17"
|
TOOLCHAIN_LIB_BASE="/mnt/gvfs/third-party/$TOOLCHAIN_REV/gcc-4.8.1-glibc-2.17"
|
||||||
TOOL_JEMALLOC=jemalloc-3.3.1/4d53c6f
|
TOOL_JEMALLOC=jemalloc-3.3.1/4d53c6f
|
||||||
|
|
||||||
@ -49,7 +54,7 @@ RANLIB=$TOOLCHAIN_EXECUTABLES/binutils/binutils-2.21.1/da39a3e/bin/ranlib
|
|||||||
|
|
||||||
CFLAGS="-B$TOOLCHAIN_EXECUTABLES/binutils/binutils-2.21.1/da39a3e/bin/gold -m64 -mtune=generic -fPIC"
|
CFLAGS="-B$TOOLCHAIN_EXECUTABLES/binutils/binutils-2.21.1/da39a3e/bin/gold -m64 -mtune=generic -fPIC"
|
||||||
CFLAGS+=" -I $TOOLCHAIN_LIB_BASE/jemalloc/$TOOL_JEMALLOC/include -DHAVE_JEMALLOC -nostdlib"
|
CFLAGS+=" -I $TOOLCHAIN_LIB_BASE/jemalloc/$TOOL_JEMALLOC/include -DHAVE_JEMALLOC -nostdlib"
|
||||||
CFLAGS+=" -DLEVELDB_PLATFORM_POSIX"
|
CFLAGS+=" -DROCKSDB_PLATFORM_POSIX -DROCKSDB_ATOMIC_PRESENT"
|
||||||
CFLAGS+=" -DSNAPPY -DGFLAGS -DZLIB -DBZIP2"
|
CFLAGS+=" -DSNAPPY -DGFLAGS -DZLIB -DBZIP2"
|
||||||
|
|
||||||
EXEC_LDFLAGS="-Wl,--dynamic-linker,/usr/local/fbcode/gcc-4.8.1-glibc-2.17/lib/ld.so"
|
EXEC_LDFLAGS="-Wl,--dynamic-linker,/usr/local/fbcode/gcc-4.8.1-glibc-2.17/lib/ld.so"
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
#define PORT_ATOMIC_POINTER_H_
|
#define PORT_ATOMIC_POINTER_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#ifdef LEVELDB_CSTDATOMIC_PRESENT
|
#ifdef ROCKSDB_ATOMIC_PRESENT
|
||||||
#include <cstdatomic>
|
#include <atomic>
|
||||||
#endif
|
#endif
|
||||||
#ifdef OS_WIN
|
#ifdef OS_WIN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -51,7 +51,7 @@ namespace port {
|
|||||||
#if defined(OS_WIN) && defined(COMPILER_MSVC) && defined(ARCH_CPU_X86_FAMILY)
|
#if defined(OS_WIN) && defined(COMPILER_MSVC) && defined(ARCH_CPU_X86_FAMILY)
|
||||||
// windows.h already provides a MemoryBarrier(void) macro
|
// windows.h already provides a MemoryBarrier(void) macro
|
||||||
// http://msdn.microsoft.com/en-us/library/ms684208(v=vs.85).aspx
|
// http://msdn.microsoft.com/en-us/library/ms684208(v=vs.85).aspx
|
||||||
#define LEVELDB_HAVE_MEMORY_BARRIER
|
#define ROCKSDB_HAVE_MEMORY_BARRIER
|
||||||
|
|
||||||
// Gcc on x86
|
// Gcc on x86
|
||||||
#elif defined(ARCH_CPU_X86_FAMILY) && defined(__GNUC__)
|
#elif defined(ARCH_CPU_X86_FAMILY) && defined(__GNUC__)
|
||||||
@ -60,7 +60,7 @@ inline void MemoryBarrier() {
|
|||||||
// this idiom. Also see http://en.wikipedia.org/wiki/Memory_ordering.
|
// this idiom. Also see http://en.wikipedia.org/wiki/Memory_ordering.
|
||||||
__asm__ __volatile__("" : : : "memory");
|
__asm__ __volatile__("" : : : "memory");
|
||||||
}
|
}
|
||||||
#define LEVELDB_HAVE_MEMORY_BARRIER
|
#define ROCKSDB_HAVE_MEMORY_BARRIER
|
||||||
|
|
||||||
// Sun Studio
|
// Sun Studio
|
||||||
#elif defined(ARCH_CPU_X86_FAMILY) && defined(__SUNPRO_CC)
|
#elif defined(ARCH_CPU_X86_FAMILY) && defined(__SUNPRO_CC)
|
||||||
@ -69,14 +69,14 @@ inline void MemoryBarrier() {
|
|||||||
// this idiom. Also see http://en.wikipedia.org/wiki/Memory_ordering.
|
// this idiom. Also see http://en.wikipedia.org/wiki/Memory_ordering.
|
||||||
asm volatile("" : : : "memory");
|
asm volatile("" : : : "memory");
|
||||||
}
|
}
|
||||||
#define LEVELDB_HAVE_MEMORY_BARRIER
|
#define ROCKSDB_HAVE_MEMORY_BARRIER
|
||||||
|
|
||||||
// Mac OS
|
// Mac OS
|
||||||
#elif defined(OS_MACOSX)
|
#elif defined(OS_MACOSX)
|
||||||
inline void MemoryBarrier() {
|
inline void MemoryBarrier() {
|
||||||
OSMemoryBarrier();
|
OSMemoryBarrier();
|
||||||
}
|
}
|
||||||
#define LEVELDB_HAVE_MEMORY_BARRIER
|
#define ROCKSDB_HAVE_MEMORY_BARRIER
|
||||||
|
|
||||||
// ARM Linux
|
// ARM Linux
|
||||||
#elif defined(ARCH_CPU_ARM_FAMILY) && defined(__linux__)
|
#elif defined(ARCH_CPU_ARM_FAMILY) && defined(__linux__)
|
||||||
@ -94,12 +94,12 @@ typedef void (*LinuxKernelMemoryBarrierFunc)(void);
|
|||||||
inline void MemoryBarrier() {
|
inline void MemoryBarrier() {
|
||||||
(*(LinuxKernelMemoryBarrierFunc)0xffff0fa0)();
|
(*(LinuxKernelMemoryBarrierFunc)0xffff0fa0)();
|
||||||
}
|
}
|
||||||
#define LEVELDB_HAVE_MEMORY_BARRIER
|
#define ROCKSDB_HAVE_MEMORY_BARRIER
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// AtomicPointer built using platform-specific MemoryBarrier()
|
// AtomicPointer built using platform-specific MemoryBarrier()
|
||||||
#if defined(LEVELDB_HAVE_MEMORY_BARRIER)
|
#if defined(ROCKSDB_HAVE_MEMORY_BARRIER)
|
||||||
class AtomicPointer {
|
class AtomicPointer {
|
||||||
private:
|
private:
|
||||||
void* rep_;
|
void* rep_;
|
||||||
@ -119,8 +119,8 @@ class AtomicPointer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// AtomicPointer based on <cstdatomic>
|
// AtomicPointer based on <atomic>
|
||||||
#elif defined(LEVELDB_CSTDATOMIC_PRESENT)
|
#elif defined(ROCKSDB_ATOMIC_PRESENT)
|
||||||
class AtomicPointer {
|
class AtomicPointer {
|
||||||
private:
|
private:
|
||||||
std::atomic<void*> rep_;
|
std::atomic<void*> rep_;
|
||||||
@ -147,7 +147,7 @@ class AtomicPointer {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef LEVELDB_HAVE_MEMORY_BARRIER
|
#undef ROCKSDB_HAVE_MEMORY_BARRIER
|
||||||
#undef ARCH_CPU_X86_FAMILY
|
#undef ARCH_CPU_X86_FAMILY
|
||||||
#undef ARCH_CPU_ARM_FAMILY
|
#undef ARCH_CPU_ARM_FAMILY
|
||||||
|
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
// Include the appropriate platform specific file below. If you are
|
// Include the appropriate platform specific file below. If you are
|
||||||
// porting to a new platform, see "port_example.h" for documentation
|
// porting to a new platform, see "port_example.h" for documentation
|
||||||
// of what the new port_<platform>.h file must provide.
|
// of what the new port_<platform>.h file must provide.
|
||||||
#if defined(LEVELDB_PLATFORM_POSIX)
|
#if defined(ROCKSDB_PLATFORM_POSIX)
|
||||||
# include "port/port_posix.h"
|
# include "port/port_posix.h"
|
||||||
#elif defined(LEVELDB_PLATFORM_CHROMIUM)
|
|
||||||
# include "port/port_chromium.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // STORAGE_LEVELDB_PORT_PORT_H_
|
#endif // STORAGE_LEVELDB_PORT_PORT_H_
|
||||||
|
@ -144,7 +144,7 @@ TEST(BlobStoreTest, CreateAndStoreTest) {
|
|||||||
Env::Default());
|
Env::Default());
|
||||||
vector<pair<Blob, string>> ranges;
|
vector<pair<Blob, string>> ranges;
|
||||||
|
|
||||||
for (int i = 0; i < 20000; ++i) {
|
for (int i = 0; i < 2000; ++i) {
|
||||||
int decision = rand() % 5;
|
int decision = rand() % 5;
|
||||||
if (decision <= 2 || ranges.size() == 0) {
|
if (decision <= 2 || ranges.size() == 0) {
|
||||||
string buf;
|
string buf;
|
||||||
|
Loading…
Reference in New Issue
Block a user