From: Igor Canadi Date: Mon, 5 May 2014 18:35:40 +0000 (-0700) Subject: Make rocksdb work with all versions of lz4 X-Git-Tag: v3.0~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9e7d00d9e7594c431cdfb3c1202f448985e3a06a;p=rocksdb.git 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 --- diff --git a/build_tools/fbcode.gcc481.sh b/build_tools/fbcode.gcc481.sh index 556d15af..d02596f0 100644 --- a/build_tools/fbcode.gcc481.sh +++ b/build_tools/fbcode.gcc481.sh @@ -44,8 +44,8 @@ BZIP_INCLUDE=" -I $TOOLCHAIN_LIB_BASE/bzip2/bzip2-1.0.6/c3f970a/include" BZIP_LIBS=" $TOOLCHAIN_LIB_BASE/bzip2/bzip2-1.0.6/c3f970a/lib/libbz2.a" LZ4_REV=065ec7e38fe83329031f6668c43bef83eff5808b -LZ4_INCLUDE=" -I /mnt/gvfs/third-party2/lz4/$LZ4_REV/r117/gcc-4.8.1-glibc-2.17/c3f970a/include" -LZ4_LIBS=" /mnt/gvfs/third-party2/lz4/$LZ4_REV/r117/gcc-4.8.1-glibc-2.17/c3f970a/lib/liblz4.a" +LZ4_INCLUDE=" -I /mnt/gvfs/third-party2/lz4/$LZ4_REV/r108/gcc-4.8.1-glibc-2.17/c3f970a/include" +LZ4_LIBS=" /mnt/gvfs/third-party2/lz4/$LZ4_REV/r108/gcc-4.8.1-glibc-2.17/c3f970a/lib/liblz4.a" # location of gflags headers and libraries GFLAGS_INCLUDE=" -I $TOOLCHAIN_LIB_BASE/gflags/gflags-1.6/c3f970a/include" diff --git a/port/port_posix.h b/port/port_posix.h index b2d16246..d20a5dff 100644 --- a/port/port_posix.h +++ b/port/port_posix.h @@ -465,8 +465,12 @@ inline bool LZ4HC_Compress(const CompressionOptions &opts, const char* input, char *p = const_cast(output->c_str()); memcpy(p, &length, sizeof(length)); size_t outlen; +#ifdef LZ4_VERSION_MAJOR // they only started defining this since r113 outlen = LZ4_compressHC2_limitedOutput(input, p + 8, length, compressBound, opts.level); +#else + outlen = LZ4_compressHC_limitedOutput(input, p + 8, length, compressBound); +#endif if (outlen == 0) { return false; }