MySQL: Make sure we clean the libraries from mysql_config
It prints libraries necessary for linking against the MySQL static library. When linking against dynamic libraries, we end up with too many parameters. We don't want to explicitly link our plugin to OpenSSL and this is especially important on macOS since Sierra no longer comes with OpenSSL development files. On my Linux: -L/usr/lib64 -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl On my macOS: -L/usr/local/Cellar/mysql/5.7.16/lib -lmysqlclient -lssl -lcrypto Instead, keep only -L options (that haven't been removed by the function $$filterLibraryPath above) and the actual client library. Change-Id: I3e3f0326f7234a26acf5fffd148fa985d0fd9c93 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
parent
1d68e3386d
commit
5556308cbf
@ -58,8 +58,10 @@
|
||||
"label": "MySQL",
|
||||
"test": "unix/mysql",
|
||||
"sources": [
|
||||
{ "type": "mysqlConfig", "query": "--libs_r" },
|
||||
{ "type": "mysqlConfig", "query": "--libs" },
|
||||
{ "type": "mysqlConfig", "query": "--libs_r", "cleanlibs": true },
|
||||
{ "type": "mysqlConfig", "query": "--libs", "cleanlibs": true },
|
||||
{ "type": "mysqlConfig", "query": "--libs_r", "cleanlibs": false },
|
||||
{ "type": "mysqlConfig", "query": "--libs", "cleanlibs": false },
|
||||
{ "libs": "-lmysqlclient_r", "condition": "!config.win32" },
|
||||
{ "libs": "-llibmysql", "condition": "config.win32" },
|
||||
{ "libs": "-lmysqlclient", "condition": "!config.win32" }
|
||||
|
@ -57,6 +57,14 @@ defineTest(qtConfLibrary_mysqlConfig) {
|
||||
libs = $$filterLibraryPath($$libs)
|
||||
# -rdynamic should not be returned by mysql_config, but is on RHEL 6.6
|
||||
libs -= -rdynamic
|
||||
equals($${1}.cleanlibs, true) {
|
||||
for(l, libs) {
|
||||
# Drop all options besides the -L one and the -lmysqlclient one
|
||||
# so we don't unnecessarily link to libs like OpenSSL
|
||||
contains(l, "^(-L|-lmysqlclient).*"): cleanlibs += $$l
|
||||
}
|
||||
libs = $$cleanlibs
|
||||
}
|
||||
$${1}.libs = "$$val_escape(libs)"
|
||||
eval(includedir = $$includedir)
|
||||
includedir ~= s/^-I//g
|
||||
|
Loading…
x
Reference in New Issue
Block a user