MuseScore
MuseScore copied to clipboard
[MU4 Issue] Compile for ARM64
Describe the bug Following the default commands for compiling results in failed compilation because the code is in x86_64 while external libraries are arm64. I cannot find an option to compile for arm64.
To Reproduce Steps to reproduce the behavior:
- Apple Silicon mac, arm64 homebrew, install deps
- Clone git
-
cmake -P build.cmake -DCMAKE_BUILD_TYPE=Release
- Build failed.
Expected behavior Default target is arm64 on arm64 systems.
Screenshots N/A
Platform information
- OS: macOS Monterey
Additional context Error output:
[ 49%] Linking CXX executable global_tests
ld: warning: ignoring file /opt/homebrew/opt/qt@5/lib/QtNetworkAuth.framework/QtNetworkAuth, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
<lots of content removed because error log exceeds maximum issue length>
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [src/framework/mpe/tests/CMakeFiles/mpe_test.dir/build.make:183: src/framework/mpe/tests/mpe_test] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:4046: src/framework/mpe/tests/CMakeFiles/mpe_test.dir/all] Error 2
[ 49%] Linking CXX static library libui.a
[ 49%] Built target ui
gmake: *** [Makefile:146: all] Error 2
CMake Error at build.cmake:249 (message):
Build step failed with status 2. See output above for details.
Building for ARM architecture with Qt 5 is not yet possible. There is a very experimental Qt 6 branch where it is supported, see #10108. But the problems with Qt 6 are still so big, that I don't expect we will switch to it until MuseScore 5.
When I have time, I will investigate it once more though, since HomeBrew now indeed conveniently provides an ARM version of Qt 5. But last time I tried with this version, I got a lot of errors that weren't immediately clear.
In your case, the problem is that you have installed the ARM version of Qt but you are building MuseScore in x86_64 mode (because that's hardcoded in the CMake files).
If you have all dependencies in x86_64 mode, building MuseScore in x86_64 mode is easily doable (I do it every day), you only need to ensure that CMake takes indeed those x86_64 versions rather than the ARM ones. See https://github.com/musescore/MuseScore/wiki/Compiling-on-Macs-with-Apple-Silicon for a quick guide.