PDA

View Full Version : Program not linking with static image plugins



andyp
7th December 2009, 17:00
We are trying to link an application on the MAC with static libraries. We have a static build of Qt 4.5.3.
We get 2 undefineds when linking our application (called qfire) namely:
Undefined symbols:
"qt_plugin_instance_qgif()", referenced from:
__Z23qt_plugin_instance_qgifv$non_lazy_ptr in qfire.o
"qt_plugin_instance_qjpeg()", referenced from:
__Z24qt_plugin_instance_qjpegv$non_lazy_ptr in qfire.o

We have specified in the .pro
QTPLUGINS += qgif qjpeg
and in the main cpp file
QIMPORT_PLUGIN(qgif)
QIMPORT_PLUGIN(qjpeg)

The libraries libqgif.a and libqjpeg.a are in the plugins/imageformats directory.

Any help from anyone would be greatly appreciated to avoid suicide before Christmas.

spirit
7th December 2009, 18:46
if you compiled Qt statically then there is no opportunity to use plugins.

dekc99
8th December 2009, 02:05
if you compiled Qt statically then there is no opportunity to use plugins.

What rubbish !! What is the section on Static Plugins (http://doc.trolltech.com/4.5/plugins-howto.html) in the Trolltech docs talking about then ?

spirit
8th December 2009, 06:09
read carefully


Plugins can be linked statically against your application. If you build the static version of Qt, this is the only option for including Qt's predefined plugins.

When compiled as a static library, Qt provides the following static plugins:

you can't load these plugins in run-time! i.e. they will not load dynamically. you have to link it with you app.

spirit
8th December 2009, 06:13
What rubbish !!
careful the things you say man. :mad:

dekc99
8th December 2009, 07:47
No, I believe you should be more careful when answering with such resolute statements. Any person reading your reply would leave with the unfortunate (mis)understanding that "if you compiled Qt statically then there is no opportunity to use plugins. And that as we know is incorrect. That should be qualified (as you did in the later post) with the fact that a statically linked Qt cannot load plugins at runtime.

The OP did not mention anything w.r.t. dynamically loading plugins, rather it looks like the OP's app: qfire is being statically linked with the statically built Qt libs and has
added the various directives to the .pro and source file(s) to also "statically" include the various Qt plugins - in this case qgif and qjpeg. The OP even makes the point that the various Qt plugins are sitting in the "plugins/imageformats" directory.

The question is why the errors after "apparently" statically including the Qt plugins ?

Further to that question, I would include:
- what exactly does the qmake directive QTPLUGIN (that is to added to the .pro) actually do ?
- is that enough to then statically link in the libqgif.a and libqjpeg.a libs ?

spirit
8th December 2009, 07:50
once again, I meant that plugins (dll's,so's) can be load dynamically if you has been built statically. is it not clear?

andyp
8th December 2009, 10:15
Can I interpose here ?
Whatever the merits/non-merits of linking dynamically, I couldn't give a ferret's goulash.
I just want to know why I get these unresolveds and how to get rid of them.:cool: