Linux makefile warning: "cc1plus: warning: MuseScore/build.debug/all.h.gch: not a PCH file"
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:
- Hang all other threads while the precompiled header is building.
- 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.