Commit d79bf000 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

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.
parent 778df046
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment