Skip to content

Commit

Permalink
Bug#26665217 BUILD WITH WITHOUT_SERVER MAY TRY LINK PLUGIN WITH LIBMY…
Browse files Browse the repository at this point in the history
…SQLD

The authentication_ldap_sasl_client plugin is a client-side plugin,
and should not be linked with server-side utilities.
Add a new argument CLIENT_ONLY to MYSQL_ADD_PLUGIN

Details:
client/mysql.cc
Fix some 'may be used uninitialized' warnings.

mysql-test/lib/My/SafeProcess/CMakeLists.txt
Remove obsolete handling of stlport, this can no longer be used for
building the server.

mysys/my_conio.c
mysys/my_windac.c
mysys/my_winfile.c
Explicitly #include "my_sys.h" which is needed in order to build.
my_sys.h is implicitly included by "mysys_priv.h" in a default build,
but not in a client-build, which does not have HAVE_PSI_INTERFACE defined.

storage/ndb/mcc/CMakeLists.txt
Skip building for client-only build, as this is part of NDB server.

storage/ndb/src/CMakeLists.txt
NDBCLIENT_SYSTEM_LIBS can be empty on some platforms, so check
contents before doing LIST(REMOVE_DUPLICATES)

storage/ndb/src/mgmsrv/ConfigInfo.cpp
Insert whitespace between text literals and preprocessor tokens.
Modern compilers will otherwise reject to do the token concatenation.

Change-Id: I0d993b131afe2f4ccbc5b1bedfa3da071d99f6a8
  • Loading branch information
Tor Didriksen committed Oct 5, 2017
1 parent e96bebd commit 6307752
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 66 deletions.
3 changes: 2 additions & 1 deletion client/mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,8 @@ int main(int argc,char *argv[])
"statement.\n");
put_info(buff,INFO_INFO);

uint protocol, ssl_mode;
uint protocol= MYSQL_PROTOCOL_DEFAULT;
uint ssl_mode= 0;
if (!mysql_get_option(&mysql, MYSQL_OPT_PROTOCOL, &protocol) &&
!mysql_get_option(&mysql, MYSQL_OPT_SSL_MODE, &ssl_mode))
{
Expand Down
14 changes: 9 additions & 5 deletions cmake/plugin.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 2017, 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 @@ -52,7 +52,7 @@ ENDMACRO()
MACRO(MYSQL_ADD_PLUGIN)
MYSQL_PARSE_ARGUMENTS(ARG
"LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME"
"STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;NOT_FOR_EMBEDDED;RECOMPILE_FOR_EMBEDDED;TEST_ONLY"
"STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;CLIENT_ONLY;MANDATORY;DEFAULT;DISABLED;NOT_FOR_EMBEDDED;RECOMPILE_FOR_EMBEDDED;TEST_ONLY"
${ARGN}
)

Expand Down Expand Up @@ -200,7 +200,9 @@ MACRO(MYSQL_ADD_PLUGIN)
DTRACE_INSTRUMENT(${target})
SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX ""
COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
TARGET_LINK_LIBRARIES (${target} mysqlservices)
IF(NOT ARG_CLIENT_ONLY)
TARGET_LINK_LIBRARIES (${target} mysqlservices)
ENDIF()

GET_TARGET_PROPERTY(LINK_FLAGS ${target} LINK_FLAGS)
IF(NOT LINK_FLAGS)
Expand All @@ -219,8 +221,10 @@ MACRO(MYSQL_ADD_PLUGIN)
# Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate
# an additional dependency.
# Use MYSQL_PLUGIN_IMPORT for static data symbols to be exported.
IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
TARGET_LINK_LIBRARIES (${target} mysqld ${ARG_LINK_LIBRARIES})
IF(NOT ARG_CLIENT_ONLY)
IF(WIN32 OR APPLE)
TARGET_LINK_LIBRARIES (${target} mysqld ${ARG_LINK_LIBRARIES})
ENDIF()
ENDIF()
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})

Expand Down
5 changes: 4 additions & 1 deletion configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND
MESSAGE(WARNING "You should upgrade to -std=c++03")
ELSE()
# cmake/os/SunOS.cmake has done version check
# /opt/solarisstudio12.4/bin/CC has CC_MINOR_VERSION == 13
IF(DEFINED CC_MINOR_VERSION AND CC_MINOR_VERSION GREATER 12)
MESSAGE("Adding -std=c++03")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
Expand All @@ -88,9 +89,11 @@ IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND
ENDIF()

# The default C++ library for SunPro is really old, and not standards compliant.
# http://www.oracle.com/technetwork/server-storage/solaris10/cmp-stlport-libcstd-142559.html
# http://www.oracle.com/technetwork/server-storage/solaris/cmp-stlport-libcstd-142559.html
# Use stlport rather than Rogue Wave,
# unless otherwise specified on command line.
# This does *not* work for building the server, only for client libraries,
# i.e. -DWITHOUT_SERVER=1
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
IF(CMAKE_CXX_COMPILER_ID MATCHES "SunPro")
IF(CMAKE_CXX_FLAGS MATCHES "-std=")
Expand Down
2 changes: 1 addition & 1 deletion libmysql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ IF(UNIX)
ENDMACRO()
ENDIF()

# In our special "mixed" builds, also install libstlport which will
# I we build client-only, we may be using libstlport which will
# be injected into the build tree by the Sun Studio part of the build.

IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND DEFINED ENV{PB2WORKDIR})
Expand Down
2 changes: 1 addition & 1 deletion libmysql/authentication_ldap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ ENDIF ()
MYSQL_ADD_PLUGIN(authentication_ldap_sasl_client
auth_ldap_sasl_client.cc log_client.cc
LINK_LIBRARIES ${SASL_LIBRARY}
MODULE_ONLY
CLIENT_ONLY MODULE_ONLY
MODULE_OUTPUT_NAME "authentication_ldap_sasl_client")
7 changes: 6 additions & 1 deletion libservices/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2017, 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 @@ -13,6 +13,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

IF(WITHOUT_SERVER)
MESSAGE(STATUS "The mysqlservices library is for server plugins only")
RETURN()
ENDIF()

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)

SET(MYSQLSERVICES_SOURCES
Expand Down
13 changes: 1 addition & 12 deletions mysql-test/lib/My/SafeProcess/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2017, 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 @@ -22,17 +22,6 @@ SET(INSTALL_ARGS
COMPONENT Test
)

# Remove linking with stlport, it's not needed and won't link correctly
# Also remove useless -R link options
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
IF(CMAKE_CXX_COMPILER_ID MATCHES "SunPro")
STRING(REPLACE " -library=stlport4" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
STRING(REPLACE " -library=stlport4" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
STRING(REPLACE " -library=stlport4" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
STRING(REGEX REPLACE " -R[^ ]+" "" CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
ENDIF()
ENDIF()

IF (WIN32)
MYSQL_ADD_EXECUTABLE(my_safe_process safe_process_win.cc ${INSTALL_ARGS})
MYSQL_ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc ${INSTALL_ARGS})
Expand Down
3 changes: 2 additions & 1 deletion mysys/my_conio.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2017, 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 @@ -15,6 +15,7 @@


#include "mysys_priv.h"
#include "my_sys.h"

#ifdef _WIN32

Expand Down
3 changes: 2 additions & 1 deletion mysys/my_windac.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2017, 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,6 +14,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */

#include "mysys_priv.h"
#include "my_sys.h"
#include "m_string.h"
#ifdef _WIN32

Expand Down
3 changes: 2 additions & 1 deletion mysys/my_winfile.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2008, 2017, 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 @@ -47,6 +47,7 @@
#ifdef _WIN32

#include "mysys_priv.h"
#include "my_sys.h"
#include "my_thread_local.h"
#include <share.h>
#include <sys/stat.h>
Expand Down
8 changes: 6 additions & 2 deletions storage/ndb/mcc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 2017 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 @@ -20,7 +20,11 @@ if(NOT DEFAULT_MYSQL_HOME)
enable_testing()
endif()

option(WITH_MCC "Include MySQL Cluster Configurator" ON)
IF(WITHOUT_SERVER)
option(WITH_MCC "Include MySQL Cluster Configurator" OFF)
ELSE()
option(WITH_MCC "Include MySQL Cluster Configurator" ON)
ENDIF()

if(NOT WITH_MCC)
message(STATUS "Skipping mcc")
Expand Down
4 changes: 3 additions & 1 deletion storage/ndb/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ ELSE()

ENDFOREACH()
ENDFOREACH()
LIST(REMOVE_DUPLICATES NDBCLIENT_SYSTEM_LIBS)
IF(NDBCLIENT_SYSTEM_LIBS)
LIST(REMOVE_DUPLICATES NDBCLIENT_SYSTEM_LIBS)
ENDIF()
MESSAGE(STATUS "System libs used by ndbclient_so: ${NDBCLIENT_SYSTEM_LIBS}")
TARGET_LINK_LIBRARIES(ndbclient_so LINK_INTERFACE_LIBRARIES
${NDBCLIENT_SYSTEM_LIBS})
Expand Down
Loading

0 comments on commit 6307752

Please sign in to comment.