MuseScore build only uses one processor core on Linux
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
PR: https://github.com/musescore/MuseScore/pull/2214
Fixed in branch master, commit 48e0f5066f
fix #76326: build only uses one processor core on Linux
Fixed in branch 2.0.3, commit 0143645ee5
fix #76326: build only uses one processor core on Linux
Automatically closed -- issue fixed for 2 weeks with no activity.