[Development] Use static qt libraries

marius.storm-olsen at nokia.com marius.storm-olsen at nokia.com
Tue Jul 24 16:26:59 CEST 2012


On 07/24/2012 05:08 AM, ext Thiago Macieira wrote:
> It looks like your system has a major issue with dynamic linking if it takes
> 10 seconds to load two or three libraries. Take QtGui's statistics (ok, on
> Linux, but it's an indication):
>
> libQtCore.so.5: 3953 relocations, 3658 relative (92%), 236 PLT entries, 0 for
> local syms (0%), 0 users
> libQtGui.so.5: 6753 relocations, 5640 relative (83%), 754 PLT entries, 0 for
> local syms (0%), 0 users
> libQtWidgets.so.5: 18271 relocations, 15668 relative (85%), 1930 PLT entries,
> 0 for local syms (0%), 0 users
>
> The number of local relocations (15668+5640+3658 = 24966) will not change.
> You'll reduce only the inter-library relocations, which are 4012 in my case. A
> quick grep of symbols coming from other libraries in my case shows it to be
> around 300.
>
> So, you'll go from 29000 relocations to 25200. So it will reduce load time,
> but I'm just not sure it will be enough.
>
> Moreover, note, that in a static build all the Q_xxx_EXPORT macros will expand
> to empty. You might have a problem using this library.
>
> PS: my build is without -fno-rtti, which I guess you are using in your case.

So, I actually gave it a go on my Linux box to see how the numbers would 
turn out. Here's what I got:

Build configuration: ./configure -shared -release -opensource 
-confirm-license
Normal shared split libraries:
   libQtCore.so.5.0.0: 4437 relocations, 3600 relative (81%), 232 PLT 
entries, 232 for local syms (100%), 0 users
   libQtGui.so.5.0.0: 6518 relocations, 4703 relative (72%), 718 PLT 
entries, 718 for local syms (100%), 0 users
   libQtNetwork.so.5.0.0: 2492 relocations, 1429 relative (57%), 598 PLT 
entries, 598 for local syms (100%), 0 users
   libQtWidgets.so.5.0.0: 19702 relocations, 15205 relative (77%), 1899 
PLT entries, 1899 for local syms (100%), 0 users
                    (Sum: 33149 relocations, 24937 relative (75%))

Normal shared monolithic library (using core, gui, network and widgets):
   libQtMassive.so: 32978 relocations, 28359 relative (85%), 380 PLT 
entries, 380 for local syms (100%), 0 users


Build configuration: ./configure -static -release -opensource 
-confirm-license
Static compile to shared monolithic library:
   libQtStatic.so: 32032 relocations, 30428 relative (94%), 402 PLT 
entries, 402 for local syms (100%), 0 users


-- 
.marius


More information about the Development mailing list