[Interest] How to deploy a qml app with Qt built statically?

Nuno Santos nunosantos at imaginando.pt
Fri May 22 20:07:59 CEST 2015


I think I have just found the problem and this is due to errors in 
documentation:

*http://doc.qt.io/qt-5/qtplugin.html*

The linker was complaining about the missing function 
*qt_static_plugin_qico*

I have dumped the lib symbols to a file and searched for 
qt_static_plugin_something and what I found was:

*qt_static_plugin_QICOPlugin*

So, I have changed the macro to: Q_IMPORT_PLUGIN(QICOPlugin)

And voila, magic happened!

This is a tricky one. Documentation SHOULD be fixed in order to avoid 
time waste.

Best,

Nuno

On 22/05/2015 18:58, Nuno Santos wrote:
> Hi,
>
> I have a tried all the ways and means. I can have the linker to link
> successfully. I have decided to use qico plugin just to be even simpler.
>
> c++ source file:
>
> #include <QtPlugin>
> Q_IMPORT_PLUGIN(qico)
>
> .pro file:
>
> QTPLUGIN += qico
>
> win32 {
>       CONFIG += dll
>       LIBS += qico.lib
> }
>
> build output:
>
> error LNK2019: unresolved external symbol "struct QStaticPlugin const
> __cdecl qt_static_plugin_qico(void)"
> (?qt_static_plugin_qico@@YA?BUQStaticPlugin@@XZ) referenced in function
> "public: __thiscall
> StaticqicoPluginInstance::StaticqicoPluginInstance(void)"
> (??0StaticqicoPluginInstance@@QAE at XZ)
>
> Any ideas?
>
> Regards,
>
> Nuno
>
> On 22/05/2015 17:44, Thiago Macieira wrote:
>> On Friday 22 May 2015 16:37:27 Nuno Santos wrote:
>>> Hi,
>>>
>>> I have compiled Qt statically. In this process I have found two
>>> difficulties:
>>>
>>> - If I don't compile it with -developer-build I don't have the plugins
>>> compiled
>> That's a bug, please report.
>>
>>> - When I finally got plugins compiled, they are static libs
>> Of course.
>>
>>> When my program is about to start it asks about plugin windows (i assume
>>> it is the platforms/qwindows.dll)
>> Which is a static library that you need to link into your application. Qmake
>> has some logic to automatically process staticplugins.
>>
>>> What is the process to deploy an application with a static build of qt?
>> Try a lot and figure it out for the plugins. Make sure they are getting linked
>> into your binary and make sure they are getting initialised too. For each
>> staticplugin, qmake should generate an extra .cpp file that calls a function
>> from the plugin to register itself.
>>
>> In order to do that, you need to list all plugins you want to use in a
>> variable (I don't remember the name, it must be in the docs).
>>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150522/35f60cb4/attachment.html>


More information about the Interest mailing list