Commit 2ec018b2 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-17953 MariaDB 10.2.19 with TokuDB incompatible with Jemalloc 5+

Simplify the check, remove redundant code.

Add a safety check to avoid linking with static jemalloc_pic.a
if jemalloc version is 5+.

This doesn't fix the issue on Gentoo, it should be fixed in the ebuild.
parent f04bbed2
...@@ -49,33 +49,41 @@ CHECK_JEMALLOC() ...@@ -49,33 +49,41 @@ CHECK_JEMALLOC()
IF(NOT LIBJEMALLOC) IF(NOT LIBJEMALLOC)
MESSAGE(WARNING "TokuDB is enabled, but jemalloc is not. This configuration is not supported") MESSAGE(WARNING "TokuDB is enabled, but jemalloc is not. This configuration is not supported")
ELSEIF(LIBJEMALLOC STREQUAL jemalloc_pic)
CHECK_CXX_SOURCE_COMPILES(
"
#include <jemalloc/jemalloc.h>
#if JEMALLOC_VERSION_MAJOR < 5
int main() { return 0; }
#else
#error
#endif
" JEMALLOC_OK)
IF (NOT JEMALLOC_OK)
MESSAGE(FATAL_ERROR "static jemalloc_pic.a can only be used up to jemalloc 4")
ENDIF()
ELSEIF(LIBJEMALLOC STREQUAL jemalloc) ELSEIF(LIBJEMALLOC STREQUAL jemalloc)
FIND_LIBRARY(LIBJEMALLOC_SO jemalloc) FIND_LIBRARY(LIBJEMALLOC_SO jemalloc)
IF(NOT LIBJEMALLOC_SO) IF(NOT LIBJEMALLOC_SO)
MESSAGE(FATAL_ERROR "jemalloc is present, but cannot be found?") MESSAGE(FATAL_ERROR "jemalloc is present, but cannot be found?")
ENDIF() ENDIF()
GET_FILENAME_COMPONENT(LIBJEMALLOC_PATH ${LIBJEMALLOC_SO} REALPATH CACHE) GET_FILENAME_COMPONENT(LIBJEMALLOC_PATH ${LIBJEMALLOC_SO} REALPATH CACHE)
ENDIF()
IF(LIBJEMALLOC_PATH AND (RPM OR DEB)) IF(RPM OR DEB)
UNSET(LIBJEMALLOC) UNSET(LIBJEMALLOC)
GET_DIRECTORY_PROPERTY(V DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITION CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES) GET_DIRECTORY_PROPERTY(V DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITION CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES)
SET(CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES "${V} jemalloc" PARENT_SCOPE) SET(CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES "${V} jemalloc" PARENT_SCOPE)
SET(systemd_env "Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"") #" ENDIF()
IF(INSTALL_SYSCONFDIR)
SET(systemd_env "Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"")
SET(cnf_malloc_lib "malloc-lib=${LIBJEMALLOC_PATH}") SET(cnf_malloc_lib "malloc-lib=${LIBJEMALLOC_PATH}")
ELSEIF(LIBJEMALLOC_PATH) CONFIGURE_FILE(tokudb.cnf.in tokudb.cnf @ONLY)
SET(systemd_env "#Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"") #" CONFIGURE_FILE(tokudb.conf.in tokudb.conf @ONLY)
SET(cnf_malloc_lib "#malloc-lib=${LIBJEMALLOC_PATH}")
ELSE()
SET(systemd_env "#Environment=\"LD_PRELOAD=/path/to/libjemalloc.so\"") #"
SET(cnf_malloc_lib "#malloc-lib=/path/to/libjemalloc.so")
ENDIF()
CONFIGURE_FILE(tokudb.cnf.in tokudb.cnf @ONLY)
CONFIGURE_FILE(tokudb.conf.in tokudb.conf @ONLY)
IF(INSTALL_SYSCONFDIR)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tokudb.conf INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tokudb.conf
DESTINATION ${INSTALL_SYSCONFDIR}/systemd/system/mariadb.service.d/ DESTINATION ${INSTALL_SYSCONFDIR}/systemd/system/mariadb.service.d/
COMPONENT tokudb-engine) COMPONENT tokudb-engine)
ENDIF()
ENDIF() ENDIF()
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-shadow") MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-shadow")
......
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