[Interest] building Qt 4.8.7 with gcc 5 and link-time optimisation on Linux

Thiago Macieira thiago.macieira at intel.com
Wed Jul 22 22:42:17 CEST 2015


On Wednesday 22 July 2015 21:57:57 René J. V. Bertin wrote:
> > qtbase:
> > ./configure [...]
> > qmake -config ltcg
> 
> When was that syntax introduced? I'm getting an error trying it even with
> qmake 5.4.2 .

$ git name-rev --tags 1bd27f24fb7f7d82f4b67cffe43e0af644709106 
1bd27f24fb7f7d82f4b67cffe43e0af644709106 tags/v5.4.0-alpha1~525

It should work on 5.4 then. The fix for static libraries came with 5.4.1, 
though.

Check if you have mkspecs/features/ltcg.prf.

> > Does it work? Yes, my GCC release build of Qt has been done with LTCG for
> > two years.
> 
> And is there a noticeable effect (apart from a measurable one)?

It takes noticeably longer to compile :-)

Well, not everything. qmake, for example, is faster to compile with -flto -fno-
fat-lto-objects than without. But that's the exception, not the rule.

Similarly, the bootstrapped binaries (qmake, moc, rcc) are smaller, despite 
the use of -ffunction-sections -Wl,--gc-sections. The libraries are bigger, but 
that might be due to my use of -O3 (causes code expansion).

I run Creator with this build (and also compile it in LTO mode), but I have no 
point of comparison. If I can't run this Creator build, it's because I broke 
something and then I need to use the debug version.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list