[Development] Use static qt libraries

marius.storm-olsen at nokia.com marius.storm-olsen at nokia.com
Mon Jul 23 16:11:54 CEST 2012


On 23/07/2012 08:56, ext song.7.liu at nokia.com wrote:
> Hi,
>
> To use the static qt libraries, now I can build out all the libQtCore.a
> , libQtGui.a , libQtWidgets.a etc with option -static.
>
> Also I can create a new shared object libQtMaster.so which is composed
> of all of above static objects (libQtXXX.a),

This would be all wrong.

The only reason for compiling several modules into one would be (of the 
top of my head) to
     1) Get cross-module optimizations (which indicate also 
cross-compile-unit optimizations, so you'll need a bin tools chain which 
can do that) to a) reduce code size, and b) improve performance.
     2) Reduce number of exported symbols.
     3) Faster shared library load time.

To do this you would have to compile each of the modules as normal 
(shared library), and then have a step which links all of the object 
files into one shared library, maybe called just qt5.so

Configuring as static only to gather them into a shared lib is wrong.


> then I want my Qt application be dynamic linked with this libQtMain.so by:
>
> QT += master
>
> so how to create this new QT module “master” that can be used from the
> .pro files ?

This is also wrong, since this would require everyone to change the way 
they create Qt projects. In this case you would want
     QT += core gui network
to do the same thing, simply to add linking to this new qt5.so library.

That way you can keep projects working both with and without this 
magical single library without further adjustments.


-- 
.marius



More information about the Development mailing list