diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2016-12-12 16:33:14 -0800 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2016-12-14 13:29:57 +0000 |
commit | 5556308cbfabb1eef63359dfec24b8bcff44cb94 (patch) | |
tree | f3e0cbd62f5a438156d5d004dee4321f8a331189 /src/sql | |
parent | 1d68e3386d7013152417b599be7798ff19331ce4 (diff) |
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>
Diffstat (limited to 'src/sql')
-rw-r--r-- | src/sql/configure.json | 6 | ||||
-rw-r--r-- | src/sql/configure.pri | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/sql/configure.json b/src/sql/configure.json index 96c82e84f9..72671b6df9 100644 --- a/src/sql/configure.json +++ b/src/sql/configure.json @@ -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" } diff --git a/src/sql/configure.pri b/src/sql/configure.pri index 1d8847b4bc..62d56e2186 100644 --- a/src/sql/configure.pri +++ b/src/sql/configure.pri @@ -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 |