Linux makefile warning: "cc1plus: warning: MuseScore/build.debug/all.h.gch: not a PCH file"

• Dec 5, 2020 - 04:27
Reported version
4.x-dev
Type
Development
Frequency
Few
Severity
S4 - Minor
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project

On a clean build and a multithreaded machine, compliling musescore results in the warning:
cc1plus: warning: MuseScore/build.debug/all.h.gch: not a PCH file

I narrowed down the issue to be due to the parallelisation of the makefile. The issue is not reproducible when building with one core. The reason this is happening is because when musescore generates all.h.gch it does so on one thread while the other threads build C++ files. As a result the compiler on other threads see the unfinished pch file and doesn't recognise the format and throws the above warning. I propose a couple of solutions:

  1. Hang all other threads while the precompiled header is building.
  2. Rename the precompiled header to something else while it is building, then name it back once it is complete.

Unfortunately, since cmake handles generating the final makefile, I'm unsure whether or not these tweaks to cmakelists.txt are possible to get rid of the warning. This is also potentially a bug in cmake's makefile generation. Either way it doesn't really impact us much but it'd be nice to get rid of the warning.


Comments

Frequency Once Few
Regression No Yes

Confirmed in Windows using QtCreator/MinGW, where I see it 8 times (on a quad core CPU with HT).
Didn't happen a couple days ago, so must be related to some recent changes