[Interest] Linking static plugins on Linux

Macumber, Daniel Daniel.Macumber at nrel.gov
Thu Sep 15 22:14:34 CEST 2016


Hello, I have an application which I am linking with static Qt and static plugins (QSQLiteDriverPlugin, platform plugins):

  Q_IMPORT_PLUGIN(QSQLiteDriverPlugin);

  #if defined(Q_OS_OSX)
    Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
  #elif defined(Q_OS_WIN)
    Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
  #elif defined(Q_OS_LINUX)
    Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
  #endif

On Windows and Mac, things are working fine.  However, on Ubuntu 14.04 (using gcc 4.8) it does not appear that dependencies of the static plugins are being linked with my application.  I am sending libxcb-static.a, libQt5Sql.a, etc to the linker but it appears that the linker does not think symbols from these libraries are used and they do not get linked in with my application.  Then, when I run my application, it attemps to load the plugin and immediately fails due to unresolved symbols.  I have tried defining QT_STATICPLUGIN but that does not seem to have an effect.

Is there any way to force static plugin dependencies to be linked with my application on Ubuntu with gcc?

Thanks a lot,
Dan


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160915/5d1b2fdc/attachment.html>


More information about the Interest mailing list