Skip to content

Commit

Permalink
Bug#23508762 THE MYSQL_SERVER DEFINE NOT DEFINED DUE TO SPELLING ERRO…
Browse files Browse the repository at this point in the history
…R IN PLUGIN.CMAKE

The MYSQL_ADD_PLUGIN macro has a spelling error causing the MYSQL_SERVER
define not to be defined. This causes the storage engine plugins to be
compiled without MYSQL_SERVER defined and thus may get a different set of
function signatures, functions and symbols unless the source of the plugins
themself define the MYSQL_SERVER define.

Fix the spelling error.

The addition of -DMYSQL_SERVER to all plugins uncovers some other bugs
when compiling performance-schema related code, so more plugins need
to be recompiled for embedded mode (without performance schema)
Before this fix, several plugins were not properly instrumented.

Remove -DMYSQL_SERVER from the 'innobase' plugin, it breaks embedded build.
The alternative would be to do RECOMPILE_FOR_EMBEDDED, but that's a lot
of extra work.

The standalone test utilities hp_test1 and hp_test2 need to be linked
against a library built without performance schema.

The standalone myisam utilities (myisam_ftdump et.al.) also need to
be linked against a library build without performance schema.

Do not include mysys_priv.h from storage/archive/azlib.h,
it breaks PFS instrumentation code.
(it includes my_dir.h anyways, and gets my_global.h from there)

Now that the MYSQL_ADD_PLUGIN macro has been fixed, we need to quote the
'curr' variable in NDB_ADD_TARGET_PROPERTY (${curr} is a list)
  • Loading branch information
Tor Didriksen committed Aug 2, 2016
1 parent 8c5baf8 commit 518e548
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 17 deletions.
4 changes: 3 additions & 1 deletion cmake/plugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ MACRO(MYSQL_ADD_PLUGIN)
# Build either static library or module
IF (WITH_${plugin} AND NOT ARG_MODULE_ONLY)
ADD_LIBRARY(${target} STATIC ${SOURCES})
SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITONS "MYSQL_SERVER")
SET_TARGET_PROPERTIES(${target}
PROPERTIES COMPILE_DEFINITIONS "MYSQL_SERVER")

DTRACE_INSTRUMENT(${target})
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
IF(WITH_EMBEDDED_SERVER AND NOT ARG_NOT_FOR_EMBEDDED)
Expand Down
5 changes: 3 additions & 2 deletions storage/archive/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -14,5 +14,6 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

SET(ARCHIVE_SOURCES azio.c ha_archive.cc ha_archive.h)
MYSQL_ADD_PLUGIN(archive ${ARCHIVE_SOURCES} STORAGE_ENGINE LINK_LIBRARIES ${ZLIB_LIBRARY})
MYSQL_ADD_PLUGIN(archive ${ARCHIVE_SOURCES}
STORAGE_ENGINE RECOMPILE_FOR_EMBEDDED LINK_LIBRARIES ${ZLIB_LIBRARY})

5 changes: 4 additions & 1 deletion storage/archive/azlib.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/*
This libary has been modified for use by the MySQL Archive Engine.
-Brian Aker
This file was modified by Oracle on 02-08-2016.
Modifications copyright (c) 2016, Oracle and/or its affiliates.
All rights reserved.
*/

/* zlib.h -- interface of the 'zlib' general purpose compression library
Expand Down Expand Up @@ -33,7 +37,6 @@
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
*/

#include "../../mysys/mysys_priv.h"
#include <my_dir.h>
#include <zlib.h>

Expand Down
4 changes: 2 additions & 2 deletions storage/csv/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -17,4 +17,4 @@ SET(CSV_PLUGIN_STATIC "csv")
SET(CSV_PLUGIN_MANDATORY TRUE)

SET(CSV_SOURCES ha_tina.cc ha_tina.h transparent_file.cc transparent_file.h)
MYSQL_ADD_PLUGIN(csv ${CSV_SOURCES} STORAGE_ENGINE MANDATORY)
MYSQL_ADD_PLUGIN(csv ${CSV_SOURCES} STORAGE_ENGINE MANDATORY RECOMPILE_FOR_EMBEDDED)
8 changes: 4 additions & 4 deletions storage/heap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -24,12 +24,12 @@ SET(HEAP_SOURCES _check.c _rectest.c hp_block.c hp_clear.c hp_close.c hp_create

MYSQL_ADD_PLUGIN(heap ${HEAP_SOURCES} STORAGE_ENGINE MANDATORY RECOMPILE_FOR_EMBEDDED)

IF(WITH_UNIT_TESTS)
IF(WITH_UNIT_TESTS AND WITH_EMBEDDED_SERVER)
ADD_EXECUTABLE(hp_test1 hp_test1.c)
TARGET_LINK_LIBRARIES(hp_test1 heap mysys)
TARGET_LINK_LIBRARIES(hp_test1 heap_embedded mysys)
ADD_TEST(hp_test1 hp_test1)

ADD_EXECUTABLE(hp_test2 hp_test2.c)
TARGET_LINK_LIBRARIES(hp_test2 heap mysys)
TARGET_LINK_LIBRARIES(hp_test2 heap_embedded mysys)
ADD_TEST(hp_test2 hp_test2)
ENDIF()
3 changes: 3 additions & 0 deletions storage/innobase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE
MODULE_OUTPUT_NAME ha_innodb
LINK_LIBRARIES ${ZLIB_LIBRARY} ${LZ4_LIBRARY})

# Remove -DMYSQL_SERVER, it breaks embedded build
SET_TARGET_PROPERTIES(innobase PROPERTIES COMPILE_DEFINITIONS "")

IF(WITH_INNOBASE_STORAGE_ENGINE)
ADD_DEPENDENCIES(innobase GenError)
ENDIF()
Expand Down
20 changes: 15 additions & 5 deletions storage/myisam/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,34 @@ MYSQL_ADD_PLUGIN(myisam ${MYISAM_SOURCES}

TARGET_LINK_LIBRARIES(myisam mysys)

IF (WITH_EMBEDDED_SERVER)
SET(MYISAM_NOPFS myisam_embedded)
TARGET_LINK_LIBRARIES(myisam_embedded mysys)
ELSE()
ADD_CONVENIENCE_LIBRARY(myisam_nopfs ${MYISAM_SOURCES})
ADD_DEPENDENCIES(myisam_nopfs GenError)
TARGET_LINK_LIBRARIES(myisam_nopfs mysys)
SET(MYISAM_NOPFS myisam_nopfs)
ENDIF()

MYSQL_ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c)
TARGET_LINK_LIBRARIES(myisam_ftdump myisam mysys_ssl)
TARGET_LINK_LIBRARIES(myisam_ftdump ${MYISAM_NOPFS} mysys_ssl)
SET_TARGET_PROPERTIES(myisam_ftdump PROPERTIES LINKER_LANGUAGE CXX)

MYSQL_ADD_EXECUTABLE(myisamchk myisamchk.c)
TARGET_LINK_LIBRARIES(myisamchk myisam mysys_ssl)
TARGET_LINK_LIBRARIES(myisamchk ${MYISAM_NOPFS} mysys_ssl)
SET_TARGET_PROPERTIES(myisamchk PROPERTIES LINKER_LANGUAGE CXX)

MYSQL_ADD_EXECUTABLE(myisamlog myisamlog.c)
TARGET_LINK_LIBRARIES(myisamlog myisam ${LIBSOCKET})
TARGET_LINK_LIBRARIES(myisamlog ${MYISAM_NOPFS} ${LIBSOCKET})

MYSQL_ADD_EXECUTABLE(myisampack myisampack.c)
TARGET_LINK_LIBRARIES(myisampack myisam mysys_ssl)
TARGET_LINK_LIBRARIES(myisampack ${MYISAM_NOPFS} mysys_ssl)
SET_TARGET_PROPERTIES(myisampack PROPERTIES LINKER_LANGUAGE CXX)

IF(WITH_UNIT_TESTS AND FALSE)
ADD_EXECUTABLE(mi_test1 mi_test1.c)
TARGET_LINK_LIBRARIES(mi_test1 myisam mysys_ssl)
TARGET_LINK_LIBRARIES(mi_test1 ${MYISAM_NOPFS} mysys_ssl)
SET_TARGET_PROPERTIES(mi_test1 PROPERTIES LINKER_LANGUAGE CXX)

ADD_EXECUTABLE(mi_test2 mi_test2.c)
Expand Down
4 changes: 2 additions & 2 deletions storage/ndb/cmake/ndb_add_target_property.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -30,7 +30,7 @@ MACRO(NDB_ADD_TARGET_PROPERTY TARGET PROPERTY VALUE)
LIST(APPEND curr ${VALUE})

# Set new PROPERTY of TARGET
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES ${PROPERTY} ${curr})
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES ${PROPERTY} "${curr}")

#GET_TARGET_PROPERTY(after ${TARGET} ${PROPERTY})
#MESSAGE(STATUS "${TARGET}.${PROPERTY}: ${after}")
Expand Down

0 comments on commit 518e548

Please sign in to comment.