summaryrefslogtreecommitdiff
path: root/storage/tokudb
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-12-14 23:07:32 +0100
committerSergei Golubchik <serg@mariadb.org>2018-12-20 08:06:55 +0100
commit2ec018b281a801089afde96ec0f5968c8ed89858 (patch)
tree5e46e7bafc20415802c76362e7b8304e295418f8 /storage/tokudb
parentf04bbed220215a0e5a5b1be9f3af5e442abe033b (diff)
downloadmariadb-git-2ec018b281a801089afde96ec0f5968c8ed89858.tar.gz
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.
Diffstat (limited to 'storage/tokudb')
-rw-r--r--storage/tokudb/CMakeLists.txt48
1 files changed, 28 insertions, 20 deletions
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index 86463c2997e..f3166ca8c0b 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -49,33 +49,41 @@ CHECK_JEMALLOC()
IF(NOT LIBJEMALLOC)
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)
FIND_LIBRARY(LIBJEMALLOC_SO jemalloc)
IF(NOT LIBJEMALLOC_SO)
MESSAGE(FATAL_ERROR "jemalloc is present, but cannot be found?")
ENDIF()
GET_FILENAME_COMPONENT(LIBJEMALLOC_PATH ${LIBJEMALLOC_SO} REALPATH CACHE)
-ENDIF()
-IF(LIBJEMALLOC_PATH AND (RPM OR DEB))
- UNSET(LIBJEMALLOC)
- 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(systemd_env "Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"") #"
- SET(cnf_malloc_lib "malloc-lib=${LIBJEMALLOC_PATH}")
-ELSEIF(LIBJEMALLOC_PATH)
- SET(systemd_env "#Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"") #"
- 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
- DESTINATION ${INSTALL_SYSCONFDIR}/systemd/system/mariadb.service.d/
- COMPONENT tokudb-engine)
+ IF(RPM OR DEB)
+ UNSET(LIBJEMALLOC)
+ 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)
+ ENDIF()
+
+ IF(INSTALL_SYSCONFDIR)
+ SET(systemd_env "Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"")
+ SET(cnf_malloc_lib "malloc-lib=${LIBJEMALLOC_PATH}")
+ CONFIGURE_FILE(tokudb.cnf.in tokudb.cnf @ONLY)
+ CONFIGURE_FILE(tokudb.conf.in tokudb.conf @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tokudb.conf
+ DESTINATION ${INSTALL_SYSCONFDIR}/systemd/system/mariadb.service.d/
+ COMPONENT tokudb-engine)
+ ENDIF()
ENDIF()
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-shadow")