[Development] Use static qt libraries

song.7.liu at nokia.com song.7.liu at nokia.com
Mon Jul 23 16:16:11 CEST 2012


Thanks for help. Is there any tool to link all of the separate shared libraries into one single shared library (libqt5.so) ?

Thanks,
Song

-----Original Message-----
From: Storm-Olsen Marius (Nokia-MP/Austin) 
Sent: Monday, July 23, 2012 10:12 PM
To: Liu Song.7 (Nokia-MP/Beijing)
Cc: development at qt-project.org
Subject: Re: [Development] Use static qt libraries
Importance: High

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