[Interest] Installation Sizes for Applications using Qt

Thiago Macieira thiago.macieira at intel.com
Thu Aug 26 16:39:16 CEST 2021


On Thursday, 26 August 2021 00:51:28 PDT BeneschTech LLC wrote:
> If you are building static, you can use the ld.gold linker which prunes a
> lot of unused code off, and maybe add in -Os to QMAKE_LFLAGS. It might not
> hurt to do a second "strip" after your executable is built too.  Anything
> using location or webkit is going to pull in a lot though.

Static linking (which is permitted under the LGPLv3 -- you just have to 
provide a way to replace the LGPLv3 content inside your binaries, somehow) is 
not as effective as the feature system that Mitch and I are talking about. It 
helps, of course, by dropping code that can't be reached. But it isn't smart 
enough to figure out some features that are referenced are unneeded.

Let's say for example that you think you won't need QRegularExpression. 
There's a feature for that ("regularexpression"). However, you will use 
QString and qstring.cpp does reference QRegularExpression directly, as does 
QMetaType and CBOR support know about it (and these features can't be 
disabled), QObject (for child object searching), QDir and QMimeDatabase (for 
wildcard matching), QStandardPaths (parsing XDG ~/.config/user-dirs.dirs). And 
this is QtCore only.

So even if you don't use QRegularExpression directly, other portions of Qt 
will, so you will include all of it and the requirement to have libpcre2 
regardless if all you do is use static linking.

On the other hand, if you disable QRegularExpression, you may find that 
QStandardPaths does not work as expected and as documented. That's what I 
meant that I will not accept any bug reports on a less-than-full build of Qt.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering





More information about the Interest mailing list