[Interest] qmake findmocs randomly skips header files (about 1 in 1000 times)

Pieter-Jan Busschaert pieterjan.busschaert at gmail.com
Mon Oct 12 10:52:15 CEST 2015


Hello,


We have a software project which consists of roughly 50 QT components, each
with their own .pro file. On our continuous build server we run qmake on
all of them after every commit. About 1 in 20 builds we have a random
linking error due to not finding the metaobject related code for some
(everytime different) class. Rerunning the build without changing anything
fixes it. I traced this problem a bit and found these things:

=> The bad .vcxproj file is missing the necessary pre-build steps for
generating the MOC objects for a random class. The .pro file clearly lists
the header file, the header file does have the Q_OBJECT macro and the class
does subclass QObject as first superclass.

=> I captured level-2 debug info from all qmake executions and found the
"findMocs" step just randomly skips a file, while it is listed correctly in
the HEADERS variable under "Dumping all variables".


Good example output of qmake -d -d:
...
DEBUG 2: findMocs: fileA.h
DEBUG 2: Mocgen: fileA.h:29 Found MOC symbol Q_OBJECT
DEBUG 2: findMocs: fileB.h
DEBUG 2: Mocgen: fileB.h:36 Found MOC symbol Q_OBJECT
DEBUG 2: findMocs: fileC.h
DEBUG 2: Mocgen: fileC.h:27 Found MOC symbol Q_OBJECT
...
DEBUG 1: HEADERS === fileA.h :: fileB.h :: fileC.h
...

Bad example output of qmake -d -d (without any changes to the relevant
files):
...
DEBUG 2: findMocs: fileA.h
DEBUG 2: Mocgen: fileA.h:29 Found MOC symbol Q_OBJECT
DEBUG 2: findMocs: fileC.h
DEBUG 2: Mocgen: fileC.h:27 Found MOC symbol Q_OBJECT
...
DEBUG 1: HEADERS === fileA.h :: fileB.h :: fileC.h
...


So, this is about 1 in 1000 (= 50 .pro files * 20 builds) qmake invocations
where a random file is skipped.
Any idea why this might happen or how I could investigate further what the
rootcause might be?

Googling doesn't turn up anything usefull, only advice to people who forget
to rerun qmake after making a change that requires it. In our case this
irrelevant, because we rerun qmake every single time.

For completeness, we are using QT 4.8.6, which has qmake version 2.01a



Kind regards,

Pieter-Jan Busschaert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151012/4bb8db64/attachment.html>


More information about the Interest mailing list