[Commits] d79bf0009a1: MDEV-16525: MyRocks linking fails with: Undefined reference to `ZDICT_trainFromBuffer'
revision-id: d79bf0009a17f0020203003a97ce7e83449aeb3a (mariadb-10.2.15-68-gd79bf0009a1) parent(s): 778df04661c72544baed4363a55b07362d5020ed author: Vicențiu Ciorbaru committer: Vicențiu Ciorbaru timestamp: 2018-06-20 01:23:07 +0300 message: MDEV-16525: MyRocks linking fails with: Undefined reference to `ZDICT_trainFromBuffer' RocksDB will only build with libzstd support if libzstd version is
=1.1.13. Unfortunately CMake's FindPackage claims it found version 1.1.13 when we have 1.1.12-1 installed, so a workaround with CheckFunctionExists is used to properly check for correct libzstd support.
--- storage/rocksdb/build_rocksdb.cmake | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake index c76f711463e..8f01024be63 100644 --- a/storage/rocksdb/build_rocksdb.cmake +++ b/storage/rocksdb/build_rocksdb.cmake @@ -64,10 +64,20 @@ if(SNAPPY_FOUND AND (NOT WITH_ROCKSDB_SNAPPY STREQUAL "OFF")) list(APPEND THIRDPARTY_LIBS ${SNAPPY_LIBRARIES}) endif() +include(CheckFunctionExists) if(ZSTD_FOUND AND (NOT WITH_ROCKSDB_ZSTD STREQUAL "OFF")) - add_definitions(-DZSTD) - include_directories(${ZSTD_INCLUDE_DIR}) - list(APPEND THIRDPARTY_LIBS ${ZSTD_LIBRARY}) + SET(CMAKE_REQUIRED_LIBRARIES zstd) + CHECK_FUNCTION_EXISTS(ZDICT_trainFromBuffer ZSTD_VALID) + UNSET(CMAKE_REQUIRED_LIBRARIES) + if (WITH_ROCKSDB_ZSTD STREQUAL "ON" AND NOT ZSTD_VALID) + MESSAGE(FATAL_ERROR + "WITH_ROCKSDB_ZSTD is ON and ZSTD library was found, but the version needs to be >= 1.1.3") + endif() + if (ZSTD_VALID) + add_definitions(-DZSTD) + include_directories(${ZSTD_INCLUDE_DIR}) + list(APPEND THIRDPARTY_LIBS ${ZSTD_LIBRARY}) + endif() endif() add_definitions(-DZLIB) @@ -119,7 +129,6 @@ int main() { endif() endif() -include(CheckFunctionExists) CHECK_FUNCTION_EXISTS(malloc_usable_size HAVE_MALLOC_USABLE_SIZE) if(HAVE_MALLOC_USABLE_SIZE) add_definitions(-DROCKSDB_MALLOC_USABLE_SIZE)
participants (1)
-
vicentiu@mariadb.org