Commit ff5a528f authored by Sergei Golubchik's avatar Sergei Golubchik

mysqltest crashes on Debian

Debian is apparently offended that pcre2-posix implements POSIX API,
thus it renames all posix-compatible symbols in libpcre2-posix to have the
PCRE2 prefix. But Debian doesn't do anything to pcre2posix.h header,
so any unaware application will get POSIX compatible type names
and function prototypes from pcre2, but actual symbols will come
from libc.

To remedy this enormous incongruity we have to redefine POSIX-compatible
function names in pcre2posix to match Debian's hack.
parent 1b1bf430
...@@ -45,7 +45,7 @@ IF(UNIX) ...@@ -45,7 +45,7 @@ IF(UNIX)
ENDIF(UNIX) ENDIF(UNIX)
MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test) MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test)
SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS") SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS ${PCRE2_DEBIAN_HACK}")
TARGET_LINK_LIBRARIES(mysqltest ${CLIENT_LIB} pcre2-posix pcre2-8) TARGET_LINK_LIBRARIES(mysqltest ${CLIENT_LIB} pcre2-posix pcre2-8)
SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE) SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE)
......
...@@ -61,6 +61,11 @@ MACRO (CHECK_PCRE) ...@@ -61,6 +61,11 @@ MACRO (CHECK_PCRE)
MESSAGE(FATAL_ERROR "system pcre2-8 library is not found or unusable") MESSAGE(FATAL_ERROR "system pcre2-8 library is not found or unusable")
ENDIF() ENDIF()
BUNDLE_PCRE2() BUNDLE_PCRE2()
ELSE()
CHECK_LIBRARY_EXISTS(pcre2-posix PCRE2regcomp "" NEEDS_PCRE2_DEBIAN_HACK)
IF(NEEDS_PCRE2_DEBIAN_HACK)
SET(PCRE2_DEBIAN_HACK "-Dregcomp=PCRE2regcomp -Dregexec=PCRE2regexec -Dregerror=PCRE2regerror -Dregfree=PCRE2regfree")
ENDIF()
ENDIF() ENDIF()
ENDMACRO() ENDMACRO()
...@@ -38,6 +38,7 @@ INCLUDE_DIRECTORIES( ...@@ -38,6 +38,7 @@ INCLUDE_DIRECTORIES(
IF(NOT HAVE_SYSTEM_REGEX) IF(NOT HAVE_SYSTEM_REGEX)
INCLUDE_DIRECTORIES(${PCRE_INCLUDES}) INCLUDE_DIRECTORIES(${PCRE_INCLUDES})
ADD_DEFINITIONS(${PCRE2_DEBIAN_HACK})
ENDIF() ENDIF()
......
...@@ -35,6 +35,7 @@ ENDIF(UNIX) ...@@ -35,6 +35,7 @@ ENDIF(UNIX)
MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc
COMPONENT Test) COMPONENT Test)
TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcre2-posix pcre2-8) TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcre2-posix pcre2-8)
SET_SOURCE_FILES_PROPERTIES(../../client/mysqltest.cc PROPERTIES COMPILE_FLAGS "${PCRE2_DEBIAN_HACK}")
IF(CMAKE_GENERATOR MATCHES "Xcode") IF(CMAKE_GENERATOR MATCHES "Xcode")
# It does not seem possible to tell Xcode the resulting target might need # It does not seem possible to tell Xcode the resulting target might need
......
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