Skip to content

Commit 9e7d00d

Browse files
committed
Make rocksdb work with all versions of lz4
Summary: There are some projects in fbcode that define lz4 dependency on r108. We, however, defined dependency on r117. That produced some interesting issues and our build system was not happy. This diff makes rocksdb work with both r108 and r117. Hopefully this will fix our problems. Test Plan: compiled rocksdb with both r108 and r117 lz4 Reviewers: dhruba, sdong, haobo Reviewed By: sdong CC: leveldb Differential Revision: https://reviews.facebook.net/D18465
1 parent d2569fe commit 9e7d00d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

build_tools/fbcode.gcc481.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ BZIP_INCLUDE=" -I $TOOLCHAIN_LIB_BASE/bzip2/bzip2-1.0.6/c3f970a/include"
4444
BZIP_LIBS=" $TOOLCHAIN_LIB_BASE/bzip2/bzip2-1.0.6/c3f970a/lib/libbz2.a"
4545

4646
LZ4_REV=065ec7e38fe83329031f6668c43bef83eff5808b
47-
LZ4_INCLUDE=" -I /mnt/gvfs/third-party2/lz4/$LZ4_REV/r117/gcc-4.8.1-glibc-2.17/c3f970a/include"
48-
LZ4_LIBS=" /mnt/gvfs/third-party2/lz4/$LZ4_REV/r117/gcc-4.8.1-glibc-2.17/c3f970a/lib/liblz4.a"
47+
LZ4_INCLUDE=" -I /mnt/gvfs/third-party2/lz4/$LZ4_REV/r108/gcc-4.8.1-glibc-2.17/c3f970a/include"
48+
LZ4_LIBS=" /mnt/gvfs/third-party2/lz4/$LZ4_REV/r108/gcc-4.8.1-glibc-2.17/c3f970a/lib/liblz4.a"
4949

5050
# location of gflags headers and libraries
5151
GFLAGS_INCLUDE=" -I $TOOLCHAIN_LIB_BASE/gflags/gflags-1.6/c3f970a/include"

port/port_posix.h

+4
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,12 @@ inline bool LZ4HC_Compress(const CompressionOptions &opts, const char* input,
465465
char *p = const_cast<char *>(output->c_str());
466466
memcpy(p, &length, sizeof(length));
467467
size_t outlen;
468+
#ifdef LZ4_VERSION_MAJOR // they only started defining this since r113
468469
outlen = LZ4_compressHC2_limitedOutput(input, p + 8, length, compressBound,
469470
opts.level);
471+
#else
472+
outlen = LZ4_compressHC_limitedOutput(input, p + 8, length, compressBound);
473+
#endif
470474
if (outlen == 0) {
471475
return false;
472476
}

0 commit comments

Comments
 (0)