Link against Connector-C.

Now, qc_mysqlembedded is linked against MySQL's embedded library,
and MaxScale itself against Connector-C.

So, in order to build MaxScale, Connector-C must be installed.
This has been tested with Connector-C 2.2.1.

The build variable MYSQLCLIENT_LIBRARIES is no longer used.
This commit is contained in:
Johan Wikman
2016-01-29 16:50:31 +02:00
parent 0c6e9f3def
commit fc6f49fe8a
16 changed files with 52 additions and 39 deletions

View File

@ -1,6 +1,6 @@
add_library(maxscale-common SHARED adminusers.c atomic.c buffer.c config.c dbusers.c dcb.c filter.c externcmd.c gwbitmask.c gwdirs.c gw_utils.c hashtable.c hint.c housekeeper.c load_utils.c maxscale_pcre2.c memlog.c modutil.c monitor.c poll.c random_jkiss.c resultset.c secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc ${CMAKE_SOURCE_DIR}/utils/skygw_utils.cc statistics.c)
target_link_libraries(maxscale-common ${MYSQLCLIENT_LIBRARIES} ${LZMA_LINK_FLAGS} ${PCRE2_LIBRARIES} ${CURL_LIBRARIES} ssl aio pthread crypt dl crypto inih z rt m stdc++)
target_link_libraries(maxscale-common ${MARIADB_CONNECTOR_LIB} ${LZMA_LINK_FLAGS} ${PCRE2_LIBRARIES} ${CURL_LIBRARIES} ssl aio pthread crypt dl crypto inih z rt m stdc++)
if(WITH_JEMALLOC)
target_link_libraries(maxscale-common ${JEMALLOC_LIBRARIES})

View File

@ -2186,6 +2186,10 @@ MYSQL *gw_mysql_init()
{
if (gw_mysql_set_timeouts(con) == 0)
{
// MYSQL_OPT_USE_REMOTE_CONNECTION must be set if the embedded
// libary is used. With Connector-C (at least 2.2.1) the call
// fails.
#if !defined(LIBMARIADB)
if (mysql_options(con, MYSQL_OPT_USE_REMOTE_CONNECTION, NULL) != 0)
{
MXS_ERROR("Failed to set external connection. "
@ -2193,6 +2197,7 @@ MYSQL *gw_mysql_init()
mysql_close(con);
con = NULL;
}
#endif
}
else
{

View File

@ -507,15 +507,7 @@ static void libmysqld_done(void)
{
if (libmysqld_started)
{
// TODO: qc_end() (if qc_mysqlembedded is used) also calls mysql_library_end(),
// TODO: which refers to the mysql_library_end() in the embedded library. This
// TODO: one would call the mysql_library_end() in the client library. It seems
// TODO: that would work, but for the fact that both de-initialize some lower
// TODO: level library, which in turn does not work. Thus, for the time being
// TODO: this call is not made.
// TODO: Linking MaxScale with Connector-C would likely make this problem
// TODO: go away.
//mysql_library_end();
mysql_library_end();
}
}