MuseScore build only uses one processor core on Linux

• Sep 8, 2015 - 20:09
Type
Functional
Severity
S4 - Minor
Status
closed
Project

I am about to commit a fix for this but I'll leave this report as a record to prevent a similar mistake occurring again. This problem creates no warnings or errors, so it is all the more important to catch it.

The Makefile is optimised to take advantage of multiple processor cores if they are present on the build system. Unfortunately, I have discovered that my recent PR unintentionally restricted the build to a single processor core.

This is because a custom makefile target is created in mscore/CMakeLists.txt called mscore_alias which depends on another makefile target mscore, but they are being built in the wrong order.

The top-level Makefile release target does the build like this:

make mscore_alias
make -j ${CPUS}

The second command calls the calls the all target which builds the mscore executable (among other things). But since mscore_alias depends on mscore, when mscore_alias is called first mscore is not yet built. Thus mscore is called from within mscore_alias and the -j option to create multiple jobs (one for each processor core) is missed.

This produces no warnings or errors, and the compiled program runs just fine. However, the build time is significantly increased on multi-core Linux systems.


Comments