[CMake] Link error when building static exe against static Qt 4.5 plugin

Stephen Collyer scollyer at netspinner.co.uk
Mon Mar 23 08:14:31 EDT 2009


2009/3/23 Andreas Pakulat <apaku at gmx.de>

>
> Are you sure yout Qt4.5 has the mysql plugin built in? There's only two
> cases for the plugins (AFAIK):
>
> a) real plugins as shared objects in the plugins dir
> b) built directly into the static Qt libs
>
> So obviously in case a) you don't need to link against the mysql-plugin,
> because Qt will load it itself during runtime and in the second case it
> should be part of the QtSql library.
>

> Can you show the relevant cpp file and cmake code?
>
> Andreas
>  <http://www.cmake.org/mailman/listinfo/cmake>


I can build the code correctly against a fully shared Qt 4.4.0 build (I've
yet to
try it against a shared Qt 4.5.0). I've built Qt 4.5.0 statically, and I see
that
the MySQL plugin is built into plugins/sqldrivers:

$ ls plugins/sqldrivers/
libqsqlite.a  libqsqlmysql.a

nm indicates that libqsqlmysql.a contains the relevant symbol:

$ nm plugins/sqldrivers/libqsqlmysql.a | grep qt_plugin_instance_qsqlmysql
00000100 000000d7 T _Z28qt_plugin_instance_qsqlmysqlv
00000000 00000008 b _ZGVZ28qt_plugin_instance_qsqlmysqlvE9_instance
00000008 00000004 b _ZZ28qt_plugin_instance_qsqlmysqlvE9_instance

and this symbol doesn't appear in QtSql:

$ nm lib/libQtSql.a | grep qt_plugin_instance_qsqlmysql
$

This is why I am assuming that I need to link against libqsqlmysql.a
explicitly when linking statically.

Steve Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090323/e202f5bd/attachment-0001.htm>


More information about the CMake mailing list