[Qt-interest] Problem linking statically against MySQL plugin

Rush Manbert rush at manbert.com
Fri Mar 20 18:09:14 CET 2009


On Mar 20, 2009, at 9:17 AM, Stephen Collyer wrote:

> I'm trying to make a fully static build of code which uses the MySQL  
> plugin on
> Opensuse 11. with gcc 4.3 and Qt 4.5.0.
>
> I'm getting the following error:
>
> ############################
> CMakeFiles/file_transfer_scheduler_exe.dir/ 
> file_transfer_scheduler.o: In function `global constructors keyed to  
> _Z15log_start_statetRK7QStringS1_S1_S1_':
> file_transfer_scheduler.cpp:(.text+0x91): undefined reference to  
> `qt_plugin_instance_qsqlmysql()'
> ############################
>
> I'm using the following defines in the case of a static build:
>
> #ifndef BUILD_SHARED_LIBS
> #include <QtPlugin>
> #define QT_STATICPLUGIN
> Q_IMPORT_PLUGIN(qsqlmysql)
> #endif
>
> Can anyone suggest what I'm doing wrong ?
>
> Steve Collyer

Here's the "is it plugged in" question. :-)

Did you remember to link against the static library that implements  
the plugin? (Although I looked at the libraries that are built  
statically and I didn't see anything named libqsqlmysql.a, so I don't  
know what library you might need.)

- Rush



More information about the Qt-interest-old mailing list